logging-log4net-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Radovan Raszka" <ras...@hasam.cz>
Subject RE: Controlling the log message format
Date Wed, 12 May 2010 13:13:23 GMT
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.Whatmore@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
 

Mime
View raw message