To try and satisfy logging requirements for multiple audiences (internal dev/tech support/customer) we are trying to find any recommended design patterns people may have used to provide multi-dimensional logs.
By this we are not just talking about multiple log appenders or extending log4j etc with new log levels. We need a flexible and dynamically configurable way of controlling system and service log requirements. Innevitably some our code will require more than one handle to perform this.
We are using apache commons with log4j and use the standard package/class name as logger name. We are thinking of prepending logger name with <log category type>. When instantiating the logger we'll use something like:
OurLogFactory.getInstance( <log type> , logger name ).
This should then allow us to separate and configure system/service layer log fairly easily, outputting to shared/separate loggers as desired.
Is anyone aware of anyone good patterns that could help cater for this type of logging requirement?
You could also look at logn: see http://logn.dev.java.net
- it has the ability to route logs by name, and it allows multiple consumers for various messages too.
i am not sure about the context of your requirement, but if you talking about logs for developers(where they need stack traces) and logs for users/system personnel(who just want to know where something failed), we use a wrapper class around the log4j logger. In this logger we override the normal logging methods(debug,info,etc) + we wrote some basic methods that takes in an exception object so that a more meaningful trace can be given to the developers.
hope this helps..
Thanks for the pointers,
Can't seem to find much on logn under java.net however. I'll try and do a few other searches, maybe it's been moved.
We considered adding another log level/method e.g. logger.system(xx) but this doesn't really satisfy our need. We need two paralell log types, each with the same array of log level method calls.
system level logger: debug, info, warn, error, fatal
service level logger: debug, info, warn, error, fatal
...and possibly more in the future.
So am thinking of prepending logger name strings to try and cater:
Thought you might be interested
How is it going with your multidimensional logging? Did you find any solution that does the trick? I am totally convinced that log cubes are the way to go.