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 raybristol <ra...@gmail.com> on 2008/09/17 05:22:50 UTC

no appenders could be found for logger, but I think I have set the classpath!

Hi experts,

I got a very common problem: no appenders could be found for logger

I was search the answer online, I can see this is caused by not setting the
log4j.xml (or properties) file in classpaths, however I think I set it, if I
do each %CLASSPATH%, then I can see log4j.xml is in there, I even use the
absolute path, my environment is windows, and I was trying to run my
application using a bat file:

set CLASSPATH=../classes
set CLASSPATH=%CLASSPATH%;../lib/sprsCommon-dev.jar

set CLASSPATH=%CLASSPATH%;../lib/commons-lang-2.0.jar
set CLASSPATH=%CLASSPATH%;../lib/commons-logging-1.0.3.jar
set CLASSPATH=%CLASSPATH%;../lib/commons-validator.jar
set CLASSPATH=%CLASSPATH%;../lib/log4j-1.2.8.jar
set CLASSPATH=%CLASSPATH%;../lib/quartz.jar
set CLASSPATH=%CLASSPATH%;../lib/ojdbc14.jar

rem log4j properties file
set
CLASSPATH=%CLASSPATH%;C:\eclipse\workspace\monitor\monitorClient\src\config\log4j.xml

set MONITOR_CONFIG_DIR=C:\eclipse\workspace\monitor\monitorClient\src
set JAVA_MONITOR_OPTS=-Xms128m -Xmx256m -Dfile.encoding=big5-HKSCS
set JAVA_MONITOR_OPTS=%JAVA_MONITOR_OPTS%
-Dmonitor.config.filename=%MONITOR_CONFIG_DIR%/config/monitorClient.properties

%JAVA% -classpath %CLASSPATH% %JAVA_MONITOR_OPTS%
com.hongyip.monitor.report.facade.TestReportServerMonitorManager


Many thanks for your help here!!!

-- 
View this message in context: http://www.nabble.com/no-appenders-could-be-found-for-logger%2C-but-I-think-I-have-set-the-classpath%21-tp19524733p19524733.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: no appenders could be found for logger, but I think I have set the classpath!

Posted by raybristol <ra...@gmail.com>.
Thanks very much for your reply!



Michael Erskine wrote:
> 
> Hi Ray,
> 
> I suggest you read the "Default Initialization Procedure" section of the
> log4j manual at http://logging.apache.org/log4j/1.2/manual.html to get
> yourself acquainted with how log4j searches for your configuration.
> 
> If all else fails you can use -Dlog4j.configuration="
> C:/eclipse/workspace/monitor/monitorClient/src/config/log4j.xml" to point
> log4j straight at your config.
> 
> Regards,
> Michael Erskine.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/no-appenders-could-be-found-for-logger%2C-but-I-think-I-have-set-the-classpath%21-tp19524733p19544513.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: no appenders could be found for logger, but I think I have set the classpath!

Posted by Michael Erskine <mi...@ketech.com>.
Hi Ray,

I suggest you read the "Default Initialization Procedure" section of the log4j manual at http://logging.apache.org/log4j/1.2/manual.html to get yourself acquainted with how log4j searches for your configuration.

If all else fails you can use -Dlog4j.configuration=" C:/eclipse/workspace/monitor/monitorClient/src/config/log4j.xml" to point log4j straight at your config.

Regards,
Michael Erskine.


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


Re: AW: no appenders could be found for logger, but I think I have set the classpath!

Posted by raybristol <ra...@gmail.com>.
You are right, thanks so so much!


Bender Heri wrote:
> 
> 
> You should only define the path and not also the file:
> 
> CLASSPATH=%CLASSPATH%;C:\eclipse\workspace\monitor\monitorClient\src\config
> 
> Instead of 
> 
> CLASSPATH=%CLASSPATH%;C:\eclipse\workspace\monitor\monitorClient\src\config\log4j.xml
> 
> 
> 
> -----Ursprüngliche Nachricht-----
> Von: raybristol [mailto:raygrrr@gmail.com] 
> Gesendet: Mittwoch, 17. September 2008 05:23
> An: log4j-user@logging.apache.org
> Betreff: no appenders could be found for logger, but I think I have set
> the classpath!
> 
> 
> Hi experts,
> 
> I got a very common problem: no appenders could be found for logger
> 
> I was search the answer online, I can see this is caused by not setting
> the
> log4j.xml (or properties) file in classpaths, however I think I set it, if
> I
> do each %CLASSPATH%, then I can see log4j.xml is in there, I even use the
> absolute path, my environment is windows, and I was trying to run my
> application using a bat file:
> 
> set CLASSPATH=../classes
> set CLASSPATH=%CLASSPATH%;../lib/sprsCommon-dev.jar
> 
> set CLASSPATH=%CLASSPATH%;../lib/commons-lang-2.0.jar
> set CLASSPATH=%CLASSPATH%;../lib/commons-logging-1.0.3.jar
> set CLASSPATH=%CLASSPATH%;../lib/commons-validator.jar
> set CLASSPATH=%CLASSPATH%;../lib/log4j-1.2.8.jar
> set CLASSPATH=%CLASSPATH%;../lib/quartz.jar
> set CLASSPATH=%CLASSPATH%;../lib/ojdbc14.jar
> 
> rem log4j properties file
> set
> CLASSPATH=%CLASSPATH%;C:\eclipse\workspace\monitor\monitorClient\src\config\log4j.xml
> 
> set MONITOR_CONFIG_DIR=C:\eclipse\workspace\monitor\monitorClient\src
> set JAVA_MONITOR_OPTS=-Xms128m -Xmx256m -Dfile.encoding=big5-HKSCS
> set JAVA_MONITOR_OPTS=%JAVA_MONITOR_OPTS%
> -Dmonitor.config.filename=%MONITOR_CONFIG_DIR%/config/monitorClient.properties
> 
> %JAVA% -classpath %CLASSPATH% %JAVA_MONITOR_OPTS%
> com.hongyip.monitor.report.facade.TestReportServerMonitorManager
> 
> 
> Many thanks for your help here!!!
> 
> -- 
> View this message in context:
> http://www.nabble.com/no-appenders-could-be-found-for-logger%2C-but-I-think-I-have-set-the-classpath%21-tp19524733p19524733.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
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/no-appenders-could-be-found-for-logger%2C-but-I-think-I-have-set-the-classpath%21-tp19524733p19544519.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