-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 
Author Message
 Post subject: log4net config
PostPosted: Fri Jul 22, 2005 4:08 pm 
hi.

I'm using nhibernate in an asp.net project, and want to know how to config my log4net. I created a file called App.config, but it didn't have any effect. I also tried to put it in my Web.config file, but didn't work either.
Does someone know how to configure it?

thanks.


Top
  
 
 Post subject:
PostPosted: Sat Jul 23, 2005 6:52 pm 
Newbie

Joined: Wed May 11, 2005 9:34 pm
Posts: 9
http://wiki.nhibernate.org/display/NH/C ... et+Logging

If that doesn't work, please provide more info.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 07, 2005 12:00 pm 
Newbie

Joined: Sun Jul 10, 2005 6:30 pm
Posts: 10
that config file doesnt work does it? It seems like you should be able to have <> inside an element right? So this isnt a valid xml tag right?

<param name="ConversionPattern" value="%d [%t] %-5p %c [%x] <%X{auth}> - %m%n" />

you would get an error on the <%X{auth}> part


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 07, 2005 12:23 pm 
Regular
Regular

Joined: Tue May 24, 2005 12:55 pm
Posts: 56
That's right. Use this instead, as best practice.
Code:
&lt;%P{user}&gt;


But this is only good if you are setting the GlobalContext property "user". I do it in a singleton in my data layer, which works for both win forms and asp.net apps.

Code:
log4net.GlobalContext.Properties["user"] = System.Threading.Thread.CurrentPrincipal.Identity.Name.ToString();


If you just want username you can use %username, but this gets the username from the thread for each log line. I've found that setting the globalContext property to be much faster when there is alot of logging going on.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.