logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ralph Goers <ralph.go...@dslextreme.com>
Subject Re: Set the log level based on command line args
Date Wed, 06 Aug 2014 20:13:04 GMT
Please see http://logging.apache.org/log4j/2.x/manual/configuration.html#Additivity


On Aug 6, 2014, at 10:42 AM, Arwen Pond <apond@book.com> wrote:

> 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
> 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.

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message