logging-log4net-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tomas Ramirez <tom...@windward.net>
Subject RE: Frist time user needs advise
Date Wed, 10 Mar 2010 19:58:06 GMT
1. as I understand it, you can put whatever string you want in GetLogger, but a good technique
is to pass the type of the class your in, like "net.windward.xmlreport" for the xmlreport
class, or "net.windward.xmlreport.runreport" for the runreport class.  If you do it that way,
then the logs show you what class the log came from.

2.  you can use XmlConfigurator.Configure. an easier way is to put it in the app.exe.config
(probably app.config in vs).  see the documentation about configuration: http://logging.apache.org/log4net/release/manual/configuration.html

- Tomas

From: Y U [mailto:livingusman@googlemail.com] On Behalf Of Information Vision
Sent: Wednesday, March 10, 2010 12:44 PM
To: log4net-user@logging.apache.org
Subject: Frist time user needs advise


I have  a vb.net winform app that uses SUB Main in module modMain as start-up.

I have copied log4net.dll and log4net.xml files to the application main folder. I have added
log4net.dll to application references.

I have added below configuration in file Logging.Xml and have placed it in the application
main folder. 

Logging.Xml -- BEGIN
    <appender name="Console" type="log4net.Appender.ConsoleAppender">
        <layout type="log4net.Layout.PatternLayout">
            <!-- Pattern to output the caller's file name and line number -->
            <conversionPattern value="%5level [%thread] (%file:%line) - %message%newline"
    <appender name="RollingFile" type="log4net.Appender.RollingFileAppender">
        <file value="example.log" />
        <appendToFile value="true" />
        <maximumFileSize value="100KB" />
        <maxSizeRollBackups value="2" />

        <layout type="log4net.Layout.PatternLayout">
            <conversionPattern value="%level %thread %logger - %message%newline"
        <level value="DEBUG" />
        <appender-ref ref="Console" />
        <appender-ref ref="RollingFile" />
Logging.Xml -- END

My questions are;

1. In modMian I added the following line

Private ReadOnly log As ILog = LogManager.GetLogger(GetType(xxxx))

What do I enter in place of xxxx?

2. How do I tell my app to use Logging.Xml for configuration from the application main folder?




View raw message