Differences between revisions 6 and 7
Revision 6 as of 2011-09-01 04:11:28
Size: 2440
Editor: 94
Revision 7 as of 2013-01-22 13:43:34
Size: 2352
Editor: bcwinotsrv02
Comment: remove spam
Deletions are marked like this. Additions are marked like this.
Line 39: Line 39:
[[http://www.theroofdoctors.net/roofing_stockton_ca.php|roofing contractors stockton]]

The API Documentation for PatternLayout covers the valid optoins and describes the effect. Sometimes the output may not be what you expected in spite of this.

F, L & l

The file name, line number and location (which is file name and line number) output will not be correct if that information is not passed to the logging call. If you use the LOG4CXX_* macros this information will be included because LOG4CXX_DEBUG(logger,"message") expands out to something like:

    ::log4cxx::StringBuffer oss;
    oss << message;
    logger->forcedLog(::log4cxx::Level::ERROR, oss.str(), __FILE__, __LINE__);

The file and line number information comes from the preprocessor macros __FILE__ and __LINE__. Because of this, the warnings in the API documentation saying location information is extremely slow. seems incorrect since those values are always passed to forcedLog via the macros.

If you didn't use the macros, you will need to pass those arguments yourself.



The name of the thread is returned by the underlying library. It is possible that the same thread id is returned every time you run the application. To prove that it is, or is not, working start a second thread and see if it's id is different.

Process name or ID

This isn't available from the built-in formatting options or arguments to the logging functions, but you can work around that by using a MappedDiagnosticContext. If at the beginning of your single or multi-threaded application you were to set the map values for user defined keys 'pid' and 'pname'. Then to your conversion pattern you would add %X{pid}  and %X{pname} . According to the documentation the map is copied by new child threads so they would continue to have those values.

See Also

Mailing List


PatternLayout/ConversionPattern (last edited 2013-01-22 13:43:34 by bcwinotsrv02)