Problem solved :) With Eclipse the Logger of Apache was choosen, but with Tomcat the Logger of SUN. So by adding into WEB-INF/classes the file commons-logging.properties, containing: org.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JCategory Log
chooses automatically the logger of Apache, which works fine, and writes to the file. -----Ursprüngliche Nachricht----- Von: Nikolay Georgiev [mailto:[EMAIL PROTECTED] Gesendet: Donnerstag, 13. April 2006 19:48 An: [email protected] Betreff: [Commons Logging] Tomcat - Don't write to the File Hello, I've adjusted the my web application on Tomcat to use commons logging, but somehow the size of the file in which it should write is always 0kb. Though, the last modified time of this file is always updated, when something is logged. So I have a Start-up-Servlet who loads the absolute filePath into a variable(log4jConfigFile) and then I call the PropertyConfigurator.configure(log4jConfigFile);. Every Class has it's own log file initialized like private static Log log = LogFactory.getLog(myclass.class); The Config File looks like that: ========================================= Config file # -------------------------------------------------------------------------- --- # Root-Logger settings - INFO should be selected to see Importoutput # -------------------------------------------------------------------------- --- log4j.rootLogger = DEBUG, default, ImportLogFile # -------------------------------------------------------------------------- --- # Logging to console with Default-Logger # -------------------------------------------------------------------------- --- log4j.appender.default = org.apache.log4j.ConsoleAppender log4j.appender.default.layout = org.apache.log4j.PatternLayout log4j.appender.default.layout.conversionPattern = %m%n # -------------------------------------------------------------------------- --- # Loggin to file with ImportLogFile-Logger # -------------------------------------------------------------------------- --- log4j.appender.ImportLogFile = org.apache.log4j.FileAppender log4j.appender.ImportLogFile.file = d:/import.log log4j.appender.ImportLogFile.append = false log4j.appender.ImportLogFile.layout = org.apache.log4j.PatternLayout log4j.appender.ImportLogFile.layout.conversionPattern = %d [%t] %-5p %c %n %m%n ========================================= Config file END So it writes to the file d:/import.log, and this file is always 0kb, but by looking at the last modified date of the file, I see that it's always accessed when log operation is executed. Does anyone have an idea, why nothing is written to the file? I'm using Tomcat 5.0 WEB-INF/lib/commons-logging-1.0.2.jar WEB-INF/lib/log4j-1.2.8.jar --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
