You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4net-user@logging.apache.org by Shireesh Thanneru <th...@yahoo.com> on 2005/08/24 06:49:28 UTC

How to enforce certain things in log messages while still giving the flexibility to add more things

I have kind of an unusual requirement here...let me explain it. While we want the extreme flexibility that Log4Net provides, we also want to make sure certain things always get logged with every log message. Basically, with each log message, we want to make sure certain things always get logged, for example: Date, Time, App Name, Class Name, Method Name, Line Number and ThreadId along with the actual log message. 

So, while we want to use the Pattern Layout that Log4Net provides which can be used to log the above information (and lot of other additional info), any one can change config file and remove these elements from it resulting in a log file that won't contain these parameters making the support people's job a nightmare. So, we are kind of looking for a middle of the road solution, where certain things always get logged (mentioned above) and developers or end users can enable more things in the PatternLayout if they want more things in the log file but they shouldn't be able to remove any of the enforced parameters.

Thanks in advance.

Regards,

Shireesh Thanneru