I am investigating migrating from log4j 1 to log4j 2.  A pattern that I have in 
many of my applications is setting the log level based on command line 
arguments.  So if the -v (verbose) option is passed I set the log level to 
Info.  The default is set to warn.
    if (line.hasOption("v"))
    {
      logger.setLevel(Level.INFO);
    }

    if (line.hasOption("d"))
    {
      logger.setLevel(Level.DEBUG);
    }

In the world of log4j 2, what is the recommended way to accomplish this?

Thanks,
Arwen



This electronic mail message contains information that (a) is or
may be CONFIDENTIAL, PROPRIETARY IN NATURE, OR OTHERWISE
PROTECTED
BY LAW FROM DISCLOSURE, and (b) is intended only for the use of
the addressee(s) named herein.  If you are not an intended
recipient, please contact the sender immediately and take the
steps necessary to delete the message completely from your
computer system.

Not Intended as a Substitute for a Writing: Notwithstanding the
Uniform Electronic Transaction Act or any other law of similar
effect, absent an express statement to the contrary, this e-mail
message, its contents, and any attachments hereto are not
intended
to represent an offer or acceptance to enter into a contract and
are not otherwise intended to bind this sender,
barnesandnoble.com
llc, barnesandnoble.com inc. or any other person or entity.

Reply via email to