1

I'm using log4perl with a set of scripts and objects. I'd like to be able to switch between different logging configurations according command line or environment parameters, e.g. in 'verbose' mode, print out all messages from INFO level upwards, a 'debug' mode that sends DEBUG messages to STDERR and other messages to STDOUT, and a silent mode that suppresses all output except FATAL messages.

What is the best way to do this? Should I have several logger config files and load the appropriate file depending on the mode that the script is to run in? If I understand the docs correctly, I want to be altering the verbosity and threshold of the root logger so that all loggers attached to objects (i.e. loggers with categories) will obey the same rules as the root logger.

1 Answer 1

3

Yes, have several configurations to choose from. Use Log::Log4perl::CommandLine for the command-line integration.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.