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 SkyMe <gs...@mail.ru> on 2009/09/30 14:02:48 UTC

Diff between Logger and Log

Hello! I faced with a such situation when Logger and Log act differently.
I configure my log4j with

DOMConfigurator.configureAndWatch(xmlFileName);

In the configure xml file there is defined only one appender - FileAppender.
So, when I'm using

Log log = LogFactory.getLog(name);

and then

log.info("I'm a log!");

it writes this log to file.

But when I'm using

Logger logger.getLogger()....
or
LogManager.getLogger()....

they write logs only to the console! Why don't they use configurations from
xml file?

context: I deploy my app to JBoss AS, I use my owm log4j.xml (not JBoss'
one), I added log4j.jar to the lib of my .ear project.

Thank you!
-- 
View this message in context: http://www.nabble.com/Diff-between-Logger-and-Log-tp25679656p25679656.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: Diff between Logger and Log

Posted by SkyMe <gs...@mail.ru>.
I know that they are from different packages, Log is a wrapper for log4j or
other.
I'm trying to figure out why log4j's Logger doesn't work, while common's Log
works fine (in described situation). I want to use Logger instead of Log.
-- 
View this message in context: http://www.nabble.com/Diff-between-Logger-and-Log-tp25679656p25685436.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: Diff between Logger and Log

Posted by Matt Brown <Ma...@citrixOnline.com>.
Log and LogFactory are not log4j classes (http://logging.apache.org/log4j/1.2/apidocs/index.html).

However they are both Commons Logging classes ( http://commons.apache.org/logging/commons-logging-1.1.1/apidocs/index.html ).

Are you using Commons Logging on accident?

Or are you trying to find out the differences between Commons Logging and Log4j? Take a look at http://commons.apache.org/logging/commons-logging-1.1.1/guide.html.



-----Original Message-----
From: SkyMe [mailto:gs_vlad@mail.ru] 
Sent: Wednesday, September 30, 2009 8:03 AM
To: log4j-user@logging.apache.org
Subject: Diff between Logger and Log


Hello! I faced with a such situation when Logger and Log act differently.
I configure my log4j with

DOMConfigurator.configureAndWatch(xmlFileName);

In the configure xml file there is defined only one appender - FileAppender.
So, when I'm using

Log log = LogFactory.getLog(name);

and then

log.info("I'm a log!");

it writes this log to file.

But when I'm using

Logger logger.getLogger()....
or
LogManager.getLogger()....

they write logs only to the console! Why don't they use configurations from xml file?

context: I deploy my app to JBoss AS, I use my owm log4j.xml (not JBoss'
one), I added log4j.jar to the lib of my .ear project.

Thank you!
--
View this message in context: http://www.nabble.com/Diff-between-Logger-and-Log-tp25679656p25679656.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