I'm trying to get the RollingFileAppender from the extra log4j companion file 
working but I'm having problems configuring the appender.  I am using this with 
the most current version of NLOG4J

The following is my config file:

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">

<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/";>
    <appender name="console" class="org.apache.log4j.ConsoleAppender">
        <param name="Target" value="System.out"/>
        <layout class="org.apache.log4j.PatternLayout">
            <param name="ConversionPattern" value="%-5p %c{1} - %m%n"/>
        </layout>
    </appender>

    <appender name="logFileAppender" 
class="org.apache.log4j.rolling.RollingFileAppender">
        <rollingPolicy class="org.apache.log4j.rolling.TimeBasedRollingPolicy">
            <param name="FileNamePattern" 
value="/log/metrics.%d{yyyy-MM-dd-HH}.log" />
        </rollingPolicy>
        <layout class="org.apache.log4j.PatternLayout">
            <param name="ConversionPattern" value="%m%n" />
        </layout>
    </appender>

    <!--         -->
    <!-- Loggers -->
    <!--         -->
    <logger name="com.barcap.eq.common.metric.LoggingMetric" additivity="false">
        <level value="INFO" />
        <appender-ref ref="console" />
        <appender-ref ref="logFileAppender" />
    </logger>

    <root>
        <priority value ="debug" />
        <appender-ref ref="console" />
    </root>

</log4j:configuration>


At startup, I get the following errors:
log4j:ERROR Element type "rollingPolicy" must be declared.
log4j:ERROR The content of element type "appender" must match 
"(errorHandler?,param*,layout?,filter*,appender-ref*)".

If I attempt to write to the appender, I then get:
log4j:WARN Please set a rolling policy for the RollingFileAppender named 
'logFileAppender'
log4j:ERROR No output stream or file set for the appender named 
[logFileAppender].

I think the issue is that the rollingPolicy element isn't defined in log4j.dtd 
but I'm not sure how to proceed with this.  Is NLOG4J not compatible with the 
companion jar?

Thanks.

_______________________________________________

This e-mail may contain information that is confidential, privileged or 
otherwise protected from disclosure. If you are not an intended recipient of 
this e-mail, do not duplicate or redistribute it by any means. Please delete it 
and any attachments and notify the sender that you have received it in error. 
Unless specifically indicated, this e-mail is not an offer to buy or sell or a 
solicitation to buy or sell any securities, investment products or other 
financial product or service, an official confirmation of any transaction, or 
an official statement of Barclays. Any views or opinions presented are solely 
those of the author and do not necessarily represent those of Barclays. This 
e-mail is subject to terms available at the following link: 
www.barcap.com/emaildisclaimer. By messaging with Barclays you consent to the 
foregoing.  Barclays Capital is the investment banking division of Barclays 
Bank PLC, a company registered in England (number 1026167) with its registered 
office at 1 Churchill Place, London, E14 5HP.  This email may relate to or be 
sent from other members of the Barclays Group.
_______________________________________________

Reply via email to