logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jacob Kjome" <h...@visi.com>
Subject Re: Separating some classes' messages from <root>
Date Thu, 24 Feb 2011 15:49:22 GMT

Seems to me that Log4j is just setting up the Root logger defined in the 
config file, which references the SERVERLOG appender and, therefore, 
configures said appender.

It is only coincidence that this has anything to do with the 
"org.serviio.console.ServiioConsole" class performing logging.  Apparently, 
this is the first logger to be called and since Log4j was not yet configured, 
it configures itself using the log4j.xml config file.

Your problem is that the root logger is referencing an appender, which points 
to a file that the user running your application has no permission to create.  
This has nothing whatsoever to do with additivity.  Your config is fine.  Your 
user's file system permissions need tweaking (or you need to point to a 
different file system location in your config).


Jake


On Wed, 23 Feb 2011 19:09:14 -0500
 "Mikhail T." <mi+thun@aldan.algebra.com> wrote:
> On 23.02.2011 18:18, Jacob Kjome wrote:
>> <logger name="special.example.com" additivity="false">
>> <level value="INFO"/>
>> <appender-ref ref="STDERR"/>
>> </logger> 
> I tried that before -- it did not work... Here is the current actual config 
>(full file is attached):
> 
>    <logger name="org.serviio.console" additivity="false">
>    <level value="INFO"/>
>    <appender-ref ref="STDERR"/>
>    </logger>
>    ...
>    <root>
>    <level value="DEBUG"/>
>    <appender-ref ref="SERVERLOG"/>
>    </root>
> 
> But, for some reason, when the class org.serviio.console.ServiioConsole 
>tries to make a log entry, log4j attempts to open the server's log-file. Here 
>is the full output of the application's start-up (with debug="true"):
> 
>    log4j: reset attribute= "false".
>    log4j: Threshold ="null".
>    log4j: Retreiving an instance of org.apache.log4j.Logger.
>    log4j: Setting [org.serviio] additivity to [true].
>    log4j: Level value for org.serviio is  [INFO].
>    log4j: org.serviio level set to INFO
>    log4j: Retreiving an instance of org.apache.log4j.Logger.
>    log4j: Setting [org.jaudiotagger] additivity to [true].
>    log4j: Level value for org.jaudiotagger is  [ERROR].
>    log4j: org.jaudiotagger level set to ERROR
>    log4j: Retreiving an instance of org.apache.log4j.Logger.
>    log4j: Setting [org.restlet] additivity to [true].
>    log4j: Level value for org.restlet is  [ERROR].
>    log4j: org.restlet level set to ERROR
>    log4j: Retreiving an instance of org.apache.log4j.Logger.
>    log4j: Setting [org.serviio.console] additivity to [false].
>    log4j: Level value for org.serviio.console is  [INFO].
>    log4j: org.serviio.console level set to INFO
>    log4j: Class name: [org.apache.log4j.ConsoleAppender]
>    log4j: Setting property [threshold] to [DEBUG].
>    log4j: Setting property [target] to [System.err].
>    log4j: Parsing layout of class: "org.apache.log4j.PatternLayout"
>    log4j: Setting property [conversionPattern] to [%d{ISO8601} %-5p
>    [%c{1}] %m%n].
>    log4j: Adding appender named [STDERR] to category [org.serviio.console].
>    log4j: Retreiving an instance of org.apache.log4j.Logger.
>    log4j: Setting [org.serviio.ui.view] additivity to [false].
>    log4j: Level value for org.serviio.ui.view is  [INFO].
>    log4j: org.serviio.ui.view level set to INFO
>    log4j: Adding appender named [STDERR] to category [org.serviio.ui.view].
>    log4j: Level value for root is  [DEBUG].
>    log4j: root level set to DEBUG
>    log4j: Class name: [org.apache.log4j.RollingFileAppender]
>    log4j: Setting property [threshold] to [DEBUG].
>    log4j: Setting property [append] to [true].
>    log4j: Setting property [file] to [/var/log/serviio/serviio.log].
>    log4j: Setting property [maxFileSize] to [500KB].
>    log4j: Setting property [maxBackupIndex] to [5].
>    log4j: Setting property [encoding] to [UTF-8].
>    log4j: Parsing layout of class: "org.apache.log4j.PatternLayout"
>    log4j: Setting property [conversionPattern] to [%d{ISO8601} %-5p
>    [%c{1}] %m%n].
>    log4j: setFile called: /var/log/serviio/serviio.log, true
>    log4j:ERROR setFile(null,true) call failed.
>    java.io.FileNotFoundException: /var/log/serviio/serviio.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:294)
>             at
>    org.apache.log4j.RollingFileAppender.setFile(RollingFileAppender.java:207)
>             at
>    org.apache.log4j.FileAppender.activateOptions(FileAppender.java:165)
>             at
>    org.apache.log4j.config.PropertySetter.activate(PropertySetter.java:307)
>             at
>    org.apache.log4j.xml.DOMConfigurator.parseAppender(DOMConfigurator.java:295)
>             at
>    org.apache.log4j.xml.DOMConfigurator.findAppenderByName(DOMConfigurator.java:176)
>             at
>    org.apache.log4j.xml.DOMConfigurator.findAppenderByReference(DOMConfigurator.java:191)
>             at
>    org.apache.log4j.xml.DOMConfigurator.parseChildrenOfLoggerElement(DOMConfigurator.java:523)
>             at
>    org.apache.log4j.xml.DOMConfigurator.parseRoot(DOMConfigurator.java:492)
>             at
>    org.apache.log4j.xml.DOMConfigurator.parse(DOMConfigurator.java:1001)
>             at
>    org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:867)
>             at
>    org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:773)
>             at
>    org.apache.log4j.helpers.OptionConverter.selectAndConfigure(OptionConverter.java:483)
>             at org.apache.log4j.LogManager.<clinit>(LogManager.java:127)
>             at
>    org.slf4j.impl.Log4jLoggerFactory.getLogger(Log4jLoggerFactory.java:73)
>             at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:242)
>             at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:254)
>             at
>    org.serviio.console.ServiioConsole.<clinit>(ServiioConsole.java:59)
> 
> Any ideas? Thanks! Yours,
> 
>    -mi
> 


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


Mime
View raw message