SharpCrafters Support Forum

        


specifying a logger for Log4PostSharp Expand / Collapse
Author
Message
Posted 6/11/2008 8:15:31 PM


Community Member
I've looked through the code but am apparently blindly missing this.  Where do you specify which logger (defined in your app.config file, for instance) Log4PostSharp will use?  As far as I can tell, it always uses the root logger, but surely I'm missing it.
Post #3313
Posted 6/14/2008 8:54:15 AM


Michal Dabrowski

Community Member
For every class that contains methods decorated with the Log attribute, Log4PostSharp creates separate logger instance. Name of the logger is set to the name of the class, including the namespace it is declared in.
Post #3314
Posted 6/3/2009 3:36:04 PM


Community Member
Hi folks.
Our team uses Log4PostSharp and we have augmented it with two new attributes (no Laos, pure hard core PostSharp):
- LoggerAttribute
 Allows to specify an explicit logger name for a class. For generic classes there is overloaded attribute constructor allowing to specify the logger name policy for the generic types. Of course, if particular generic type parameter is also attributed with the LoggerAttribute, then the explicit name takes always precedence.
 This attribute is not multicast.
- LoggerPolicyAttribute
 This multicast attribute allows to change the policy used by the Log4PostSharp when choosing the logger name. It allows to select between Type.Name, Type.FullName and Type.AssemblyQualifiedName.

We find these attributes extremely useful, since they make logs much more readable.
I wish to submit our changes to the community, but do not know how.
Anyone wishing to get the source may contact me at
mark dot kharitonov (no spam please) at gmail dot com
Post #3315
« Prev Topic | Next Topic »


All times are GMT +1:00, Time now is 10:11am