You are correct the DebugAppender sends the output to the Visual Studio output 
window, the ConsoleAppender happens to send the ouput to the Console or 
"Output" window in Eclipse - although not 100% semantically correct to call 
them the same - they have the same end result (logging to the IDE output 
window), which is extremely useful during development

-----Original Message-----
From: Radovan Raszka [mailto:ras...@hasam.cz] 
Sent: Wednesday, May 12, 2010 9:13 AM
To: Log4NET User
Subject: RE: Controlling the log message format

I think DebugAppender in log4net is something different you think ;-)))
There is ConsoleAppender in log4net which works correctly according to 
configuration and probably corresponds to Java's ConsoleAppender.
I have never used DebugAppender, but it probably send its output to the Output 
window in Visual Studio

Radovan

-----Původní zpráva-----
Od: Steven Whatmore [mailto:steven.whatm...@purefacts.com] 
Odesláno: 12. května 2010 13:41
Komu: Log4NET User
Předmět: RE: Controlling the log message format

Ross,

We have a very similar set of Appenders to the log4net (as expected since it is 
a port as far as I know)

        JAVA                                    .NET

        ConsoleAppender                 DebugAppender
        JDBCAppender                    ADONetAppender
        DailyRollingFileAppender        RollingFileAppender

In fact I believe that most of the core Appenders included with log4j have a 
corresponding counterpart in log4net

The configuration is slightly different depending on what version since the 
version that we are currently using in log4j is using the older property file 
format as opposed to an XML configuration file (but I believe the newer version 
of log4j has the XML configuration file option), and the actual specification 
for the formats are specified in a different manner

As an example, here is the configuration option for the ConsoleAppender

    Java

    log4j.appender.DebugAppender=org.apache.log4j.ConsoleAppender
    log4j.appender.DebugAppender.layout=org.apache.log4j.PatternLayout
    log4j.appender.DebugAppender.layout.ConversionPattern=%d{ISO8601} %-5p [%t] 
%c %M - %m\n

    .NET
        
    <appender name="DebugAppender" type="log4net.Appender.DebugAppender">
        <layout type="log4net.Layout.PatternLayout">
            <conversionPattern value="%date %-5level [%thread] - 
%message%newline" />
        </layout>
    </appender>

and the root logger

    Java

    log4j.rootLogger=DEBUG, DebugAppender, DailyRollingFileAppender

    .NET

    <root>
        <level value="DEBUG" />
        <appender-ref ref="DebugAppender" />
        <appender-ref ref="RollingFileAppender" />
    </root>

The similarities should be fairly obvious.

Whatty
 

Reply via email to