On Sunday 18 Mar 2012 23:40:44 Marco Schulze wrote:
> One thing has been bothering me: those 'if (logMINOR) Logger.minor(...', 
> and the mess that logging is inside fred. I've written a very simple 
> replacement for Logger + associated classes with the following changes:

You're not using the java logging API?

The if(logMINOR) is *ABSOLUTELY VITAL* for performance. You simply cannot get 
rid of it. Generating the strings costs significantly more CPU than the rest of 
what Freenet does put together.
> 
> - Log level (renamed to severity) filtering is done by Logging.log();

Feel free to rename it. I don't see much point though unless you are trying to 
use a standard API, which *may* be a good idea.

> - Specific writer classes are replaced by a simple OutputStream, which 
> defaults to System.err. Formatting is also unified;

Very bad idea. There are many excellent reasons for the complexity that is 
FileLoggerHook. One is that if System.err is blocked (e.g. a full disk), 
everything grinds to a halt. Adequate caching is also essential, and I'm not 
certain whether there are locking issues; and dropping log lines when we can't 
keep up rather than just slowing down the rest of the node is a good thing.

> - Severity cases are broadened (FATAL, ERROR, WARNING, INFO, DEBUG and 
> TRACE), MINOR is mapped to DEBUG, and NORMAL is mapped to INFO;

Using the standard classes is fine by me.

> - No logging method accepts an Object parameter - hashCode() is not 
> exactly useful.

We're not after the hashcode, we're after the class name. We need to be able to 
filter by it, and that is essential.
> 
> Additionally, log rotation will be moved outside (possibly inside Node).

Not a good idea, for reasons of locking, file handle handling, the fact that 
you can't rename a file that is open on Windows ... There are GOOD REASONS for 
all the complexity, but feel free to tinker with the API, or give specific 
arguments other than "this is all so complicated it *ought to* be possible to 
do something radically simpler".
> 
> Currently, the log format is '<severity>\t<message>'.

We need the timestamp, in a great many cases.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: 
<https://emu.freenetproject.org/pipermail/devl/attachments/20120319/b20b27e0/attachment.pgp>

Reply via email to