You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by lp_1431 <pl...@gmail.com> on 2008/05/06 15:02:29 UTC

Setting logging levels

I m new to log4j. Is the logging level put in the properties file is a
default logging level that is set? How is that logging level accessed when
we write... 

logger.info("Info message"); 

in the main program. Please let me know about this. THANKS
-- 
View this message in context: http://www.nabble.com/Setting-logging-levels-tp17082241p17082241.html
Sent from the Log4j - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


RE: Setting logging levels

Posted by Katy Podolner <Ka...@aternity.com>.
You can also define the log level in the Appender , using the following
<filter class="org.apache.log4j.varia.LevelRangeFilter">
                        <param name="LevelMin" value="ERROR" />
                </filter>

(useful when trying to define 2 different loggers with different log level for the same package/class)

--Katy


-----Original Message-----
From: Robert Pepersack [mailto:RPepersack@mdinsurance.state.md.us]
Sent: Tuesday, May 06, 2008 4:28 PM
To: Log4J Users List
Subject: Re: Setting logging levels

You attach your logging level to your logger.

You can specify your log4j configuration properties in file by using PropertyConfigurator.configure(String configFilename).  You can also configure log4j by using some of the other methods of PropertyConfigurator.  For example, you can create a java.util.Properties object and pass it into PropertyConfigurator.configure(Properties properties).

log4j automatically appends or drops the logging request based on the level you attach to your logger.  For example, if you set your logging level to INFO, then logger.info("Your message"); would append your message.  But, if you set the level to ERROR, then logger.info("Your message"); would be dropped (not appended).

>>> lp_1431 <pl...@gmail.com> 05/06/2008 9:02 AM >>>

I m new to log4j. Is the logging level put in the properties file is a
default logging level that is set? How is that logging level accessed when
we write...

logger.info("Info message");

in the main program. Please let me know about this. THANKS
--
View this message in context: http://www.nabble.com/Setting-logging-levels-tp17082241p17082241.html
Sent from the Log4j - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Re: Setting logging levels

Posted by Robert Pepersack <RP...@mdinsurance.state.md.us>.
You attach your logging level to your logger.

You can specify your log4j configuration properties in file by using PropertyConfigurator.configure(String configFilename).  You can also configure log4j by using some of the other methods of PropertyConfigurator.  For example, you can create a java.util.Properties object and pass it into PropertyConfigurator.configure(Properties properties).

log4j automatically appends or drops the logging request based on the level you attach to your logger.  For example, if you set your logging level to INFO, then logger.info("Your message"); would append your message.  But, if you set the level to ERROR, then logger.info("Your message"); would be dropped (not appended).

>>> lp_1431 <pl...@gmail.com> 05/06/2008 9:02 AM >>>

I m new to log4j. Is the logging level put in the properties file is a
default logging level that is set? How is that logging level accessed when
we write... 

logger.info("Info message"); 

in the main program. Please let me know about this. THANKS
-- 
View this message in context: http://www.nabble.com/Setting-logging-levels-tp17082241p17082241.html 
Sent from the Log4j - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org 
For additional commands, e-mail: log4j-user-help@logging.apache.org 



---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org