Chad,

Putting DOMConfigurator.Configure() in the
Application_Start initialized log4net before I changed
the log4net section in the web.config file. So, I
doubt this is an issue.

Could you please create (or send one that is already
created) a Console Application that logs to two files
seperately, and uses a Configuration file to configure
log4net.

Thanks,

Ron.


--- Chad Myers <[EMAIL PROTECTED]> wrote:
> Your log4net config looks right, so other than that
> it's an OS or
> ASP.NET config issue or perhaps your code or
> something.
> 
> I'm not too familiar with logging from ASP.NET apps
> as I haven't had to
> do it yet, but perhaps putting the
> DOMConfigurator.Configure() call in
> the Application_Start might not be the best thing to
> do. Perhaps it's
> not initializing log4net properly in time?
> 
> You might try looking at the [assembly:] attributes
> for Log4net to
> initialize when the assembly is loaded?
> 
> -Chad
> 
> -----Original Message-----
> From: Ronnie Hayden [mailto:[EMAIL PROTECTED] 
> Sent: Thursday, May 27, 2004 9:11 PM
> To: Log4NET User
> Subject: RE: Independent FileAppenders
> 
> Please help me out with this. It is important. Is
> anyone able to do this? Or could it be that there is
> a
> bug in log4net? Or is this feature not yet
> implemented?
> 
> Please help.
> 
> Ronnie.
> 
> --- Ronnie Hayden <[EMAIL PROTECTED]> wrote:
> > I tried it, but it still doesn't work, even if I
> > give
> > the User Group "Everyone", "Full Control"
> > permission.
> > 
> > Could some kind soul please make an ASP .NET
> > application that does this and send me the
> relevant
> > files. Please.
> > 
> > Thanks,
> > 
> > Ronnie.
> > 
> > --- Chad Myers <[EMAIL PROTECTED]> wrote:
> > > That looks right.
> > > 
> > > I missed that this is an ASP.NET app. Perhaps
> the
> > > ASPNET user (Win2K) or
> > > the NETWORK user (Win2003) doesn't have access
> to
> > > write to C:\ (and very
> > > well shouldn't!).
> > > 
> > > You might try creating a folder called
> c:\weblogs
> > or
> > > something and allow
> > > ASPNET or NETWORK write access to it.
> > > 
> > > -Chad
> > > 
> > > -----Original Message-----
> > > From: Ronnie Hayden
> > [mailto:[EMAIL PROTECTED] 
> > > Sent: Wednesday, May 26, 2004 10:49 PM
> > > To: Log4NET User
> > > Subject: RE: Independent FileAppenders
> > > 
> > > I tried this, but couldn't get it to work.
> > > 
> > > My log4net section in the web.config file now
> > looks
> > > like this:
> > > 
> > >   <log4net debug="false">
> > >     <appender name="MainLog"
> > > type="log4net.Appender.FileAppender,log4net" >
> > >       <param name="File" value="C:\\MainLog.txt"
> > />
> > >       <param name="AppendToFile" value="true" />
> > >       <layout
> > > type="log4net.Layout.PatternLayout,log4net">
> > >         <param name="ConversionPattern"
> value="%d
> > > %-5p
> > > %m%n" />
> > >       </layout>
> > >     </appender>
> > >     <appender name="OtherLog"
> > > type="log4net.Appender.FileAppender,log4net" >
> > >       <param name="File"
> value="C:\\OtherLog.txt"
> > />
> > >       <param name="AppendToFile" value="true" />
> > >       <layout
> > > type="log4net.Layout.PatternLayout,log4net">
> > >         <param name="ConversionPattern"
> value="%d
> > > %-5p
> > > %m%n" />
> > >       </layout>
> > >     </appender>
> > >    <root>
> > >       <level value="DEBUG"/>
> > >       <appender-ref name="MainLog"/>
> > >    </root>
> > >    <logger name="DataLogger" additivity="false">
> > >       <level value="DEBUG"/>
> > >       <appender-ref name="OtherLog"/>
> > >    </logger>
> > >   </log4net>
> > > 
> > > My code-behind code looks like this:
> > > 
> > > Private Shared ReadOnly oMainLog As ILog =
> > > LogManager.GetLogger(GetType(TestLog4Net))
> > > 
> > > Private Shared ReadOnly oDataLog As ILog =
> > > LogManager.GetLogger("DataLogger")
> > > 
> > > To log a message I use code like this:
> > > 
> > > oMainLog.Fatal(txtMessage.Text)
> > > or
> > > oDataLog.Fatal(txtMessage.Text)
> > > 
> > > My global.asax.vb has this line in the
> > > Application_Start event:
> > > 
> > > log4net.Config.DOMConfigurator.Configure()
> > > 
> > > When I tried this, it didn't write to either of
> > the
> > > log files.
> > > 
> > > Please let me know what I am doing wrong.
> > > 
> > > Thanks,
> > > 
> > > Ronnie.
> > > 
> > > 
> > > --- Chad Myers <[EMAIL PROTECTED]> wrote:
> > > > You need to configure loggers independently.
> > > > 
> > > > You should do this:
> > > > 
> > > > <log4net debug="false">
> > > >    <appender name="File1Appender"....
> > > > 
> > > >    <appender name="File2Appender"...
> > > > 
> > > >    <appender name="RootFileAppender"...
> > > > 
> > > >    <root>
> > > >       <level value="DEBUG"/>
> > > >       <appender-ref name="RootFileAppender"/>
> > > >    </root>
> > > > 
> > > >    <logger name="YourCorp.SomeProj.SomeClass"
> > > > additivity="false">
> > > >       <level value="INFO"/>
> > > >       <appender-ref name="File1Appender"/>
> > > >    </logger>
> > > > 
> > > >    <logger name="YourCorp.SomeProj.OtherClass"
> > > > additivity="false">
> > > >       <level value="INFO"/>
> > > >       <appender-ref name="File2Appender"/>
> > > >    </logger>
> > > >   </log4net>
> > > > 
> > > > -Chad
> > > > 
> > > > -----Original Message-----
> > > > From: Ronnie Hayden
> > > [mailto:[EMAIL PROTECTED] 
> > > > Sent: Wednesday, May 26, 2004 4:17 AM
> > > > To: [email protected]
> > > > Subject: Independent FileAppenders
> > > > 
> > > > I am using log4net 1.1.1
> > > > 
> > > > I need to log messages to two different log
> > files
> > > > separately. For example I need to log "Message
> > 1"
> > > to
> > > > "C:\Log1.txt" and "Message 2" to
> "C:\Log2.txt".
> > > > Logging to one log file should not have any
> > effect
> > > > on
> 
=== message truncated ===



        
                
__________________________________
Do you Yahoo!?
Friends.  Fun.  Try the all-new Yahoo! Messenger.
http://messenger.yahoo.com/ 

Reply via email to