Discussions

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?

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.

TechTarget provides technology professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective purchase decisions and managing their organizations technology projects - with its network of technology-specific websites, events and online magazines.