permission denied problem
hello all am creating a log file using log4j , my log4j.properties setup is log4j.appender.RFA.File=${PATH}/${LOG_FILE}.log am setting my PATH LOG_FILE from my java class. props.put(PATH, /home/hari/log4j); props.put(LOG_FILE, test123_date); when i run my program it writes the log , but it throws log4j:ERROR setFile(null,true) call failed. java.io.FileNotFoundException: /.log (Permission denied) at java.io.FileOutputStream.openAppend(Native Method) at java.io.FileOutputStream.init(FileOutputStream.java:177) at java.io.FileOutputStream.init(FileOutputStream.java:102) at org.apache.log4j.FileAppender.setFile(FileAppender.java:290) at org.apache.log4j.FileAppender.activateOptions(FileAppender.java:164) at org.apache.log4j.config.PropertySetter.activate(PropertySetter.java:257) at org.apache.log4j.config.PropertySetter.setProperties(PropertySetter.java:133) at org.apache.log4j.config.PropertySetter.setProperties(PropertySetter.java:97) at org.apache.log4j.PropertyConfigurator.parseAppender(PropertyConfigurator.java:689) at org.apache.log4j.PropertyConfigurator.parseCategory(PropertyConfigurator.java:647) at org.apache.log4j.PropertyConfigurator.configureRootCategory(PropertyConfigurator.java:544) at org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator.java:440) at org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator.java:476) at org.apache.log4j.helpers.OptionConverter.selectAndConfigure(OptionConverter.java:471) at org.apache.log4j.LogManager.clinit(LogManager.java:125) at org.apache.log4j.Logger.getLogger(Logger.java:118) at org.npedia.log4j.Logging.clinit(Logging.java:24) could any1 help me out of this. -- View this message in context: http://www.nabble.com/permission-denied-problem-tp26004847p26004847.html Sent from the Log4j - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-user-h...@logging.apache.org
AW: Logging without logging to the root logger
logger name=db_report additivity=false level value=info / appender-ref ref=reportFileAppender/ /logger -Ursprüngliche Nachricht- Von: Ofer Kalisky [mailto:kali...@hotmail.com] Gesendet: Mittwoch, 21. Oktober 2009 20:15 An: log4j-user@logging.apache.org Betreff: Logging without logging to the root logger Hi, I have the following config: log4j:configuration xmlns:log4j=http://jakarta.apache.org/log4j/; appender name=reportFileAppender class=org.apache.log4j.RollingFileAppender !-- Keep one backup file -- layout class=org.apache.log4j.PatternLayout /layout /appender appender name=stdoutAppender class=org.apache.log4j.ConsoleAppender layout class=org.apache.log4j.PatternLayout /layout /appender logger name=db_report level value=info / appender-ref ref=reportFileAppender/ /logger logger name=com.mycompany level value=info / /logger root priority value=warn/ appender-ref ref=stdoutAppender/ /root /log4j:configuration In the source I do: private static Logger reportLogger = Logger.getLogger(db_report); and in other classes I do: private static Logger anyClassLogger = Logger.getLogger(com.mycompany.MyClass.class); I would like things logged to the db_report not to be logged in the stdoutAppender, but I can't get them out of there, since the root logger has it and it seems it catches all... how can I log things to the report.log file without it being outputted to the stdout as well? thanks -- View this message in context: http://www.nabble.com/Logging-without-logging-to-the-root-logger-tp25997550p25997550.html Sent from the Log4j - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-user-h...@logging.apache.org - To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-user-h...@logging.apache.org
Re: permission denied problem
are you sure you are setting your props before log4j is loaded? from the error looks like log4j did not read these props. On Thu, Oct 22, 2009 at 8:45 AM, m.harig m.ha...@gmail.com wrote: hello all am creating a log file using log4j , my log4j.properties setup is log4j.appender.RFA.File=${PATH}/${LOG_FILE}.log am setting my PATH LOG_FILE from my java class. props.put(PATH, /home/hari/log4j); props.put(LOG_FILE, test123_date); when i run my program it writes the log , but it throws log4j:ERROR setFile(null,true) call failed. java.io.FileNotFoundException: /.log (Permission denied) at java.io.FileOutputStream.openAppend(Native Method) at java.io.FileOutputStream.init(FileOutputStream.java:177) at java.io.FileOutputStream.init(FileOutputStream.java:102) at org.apache.log4j.FileAppender.setFile(FileAppender.java:290) at org.apache.log4j.FileAppender.activateOptions(FileAppender.java:164) at org.apache.log4j.config.PropertySetter.activate(PropertySetter.java:257) at org.apache.log4j.config.PropertySetter.setProperties(PropertySetter.java:133) at org.apache.log4j.config.PropertySetter.setProperties(PropertySetter.java:97) at org.apache.log4j.PropertyConfigurator.parseAppender(PropertyConfigurator.java:689) at org.apache.log4j.PropertyConfigurator.parseCategory(PropertyConfigurator.java:647) at org.apache.log4j.PropertyConfigurator.configureRootCategory(PropertyConfigurator.java:544) at org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator.java:440) at org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator.java:476) at org.apache.log4j.helpers.OptionConverter.selectAndConfigure(OptionConverter.java:471) at org.apache.log4j.LogManager.clinit(LogManager.java:125) at org.apache.log4j.Logger.getLogger(Logger.java:118) at org.npedia.log4j.Logging.clinit(Logging.java:24) could any1 help me out of this. -- View this message in context: http://www.nabble.com/permission-denied-problem-tp26004847p26004847.html Sent from the Log4j - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-user-h...@logging.apache.org