Hi Remy,
if we only want to give an alternative for the SimpleFormatter:
that one is not configurable, so it's capabilities are printing out a
localized timestamp, after that the class and method, a localized level
string, and last the log message. All of those are basically given by
the log record, level localization is provided by the Level class,
Timestamp is not problem (milliseconds in the log record), and should
also contain the millisesond fraction.
Of course we could add configurability in a next step, which would
basically mean an accesslog/log4j like pattern string for the log line.
The log record carries the following information:
- level
- message
- milliseconds timestamp
- source class and method name
- thread id
- logger name
- sequence number (interesting feature, so one can easily describe,
which message instance in a log one is talking about)
and more complex objects
- thrown (throwable associated with the record)
- resource bundle and/or resource bundle name to format message string
- parameters, log data extension
The simple objects could be configured by a simple pattern character,
the more complex ones need more thought :)
I think already the direct simpleformatter replacement, even without
configurability would be an improvement!
If that formatter would work with j.u.l. i.e. without juli, I would love
it even more. The configurability of course might add a slight
dependency to juli (where do we get the parameters from, i.e. how do we
pass the information from logging.properties to the formatter). Not
really a dependency, but probably additional setters that are called by
juli, and when using the formatter in j.u.l one would have to write the
code that calls the setters oneself (or use juli).
Regards,
Rainer
Remy Maucherat wrote:
Rainer Jung wrote:
That's why it would be nice if someone took the burden of writing a
better log formatter for j.u.l.
What should it look like ?
Rémy
Object[] getParameters()
Get the parameters to the log message.
ResourceBundle getResourceBundle()
Get the localization resource bundle
String getResourceBundleName()
Get the localization resource bundle name
long getSequenceNumber()
Get the sequence number.
Throwable getThrown()
Get any throwable associated with the log record.
void setParameters(Object[] parameters)
Set the parameters to the log message.
void setResourceBundle(ResourceBundle bundle)
Set the localization resource bundle.
void setResourceBundleName(String name)
Set the localization resource bundle name.
void setSequenceNumber(long seq)
Set the sequence number.
void setThrown(Throwable thrown)
Set a throwable associated with the log event.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]