RE: Log project
How do I set up different logging severity levels for different log types? For instance, I can set the log severity to Info, but that covers all log types, do I just need to add a log severity for each type of log? That way I can set the logseverity for email and the log severity for file and the log severity for console. And yes they need to be different, since when the log event happens if it is an error it should not only log into the log file but also send an email, but if it is info then it should only write to the log file and not send an email.
Or is there something I am missing?
Tony Blogumas, Jun 28, 2011
Steps I could think of :"
1) Build the chain of Loggers (File, email, DB etc.,)
2) Pass the error (or Info) obejct to First in the chain , say File Logger, this Class will decide if it need to log, if yes, will log and then send your "Error object" to next in the chain - say "Email Logger (sender)"
3) Email Logger Class will check if it eligible to be sent , if yes will send email and will pass it to next in the chain, say DB.
4) DB Logger will check and lets us assume its not a eligible one and will end the chain signallig the completion.
Please refer to my blog where I have talked more about this pattern (of course with a Builder Pattern variation)
Hope this helps.
Tarriq Ferrose Khan
Tarriq Ferrose Khan, Aug 15, 2011