[logback-dev] Least-effort logging with bytecode modification
Robert Elliot
rob at lidalia.org.uk
Tue Nov 18 16:55:24 CET 2008
Thanks - I checked the slf4j-ext project when I started, but not the Subversion repository. I presume this is a post-compile step rather than runtime byte code alteration?
A few things I'm implementing in my aspectj based version which you may or may not be interested in:
1) something like a PatternLayout to allow the user to choose the format of the messages at runtime (I prefer single > to double >> for instance on method entry - petty, but I feel it should be up to the user! And it's nice to be able to truncate parameter or return values if they are going to be utterly huge)
2) trace logging of field value changes so you get output like this:
fieldName initialValue -> newValue
3) loggers named after the class and method / field name, so you can be more fine grained in what output you get
4) passing the stacktrace to the output (depending on how you configure the pattern) so that if you are interested in what it was that changed the field or called the method you don't need trace logging on for the entire application
5) an @Secure annotation to allow the programmer to mark a parameter or return value as something that should not be accessible via trace logging - e.g. a password
Out of curiousity (not criticising!) what was the reason for picking javassist rather than aspectj?
Rob
----- Original Message -----
From: "Ralph Goers" <ralph.goers at dslextreme.com>
To: "logback developers list" <logback-dev at qos.ch>
Sent: Tuesday, 18 November, 2008 3:37:12 PM GMT +00:00 GMT Britain, Ireland, Portugal
Subject: Re: [logback-dev] Least-effort logging with bytecode modification
You should have a look at the slf4j extensions project first. There is
something in development there.
Robert Elliot wrote:
> I have an AspectJ project I'm working on to add trace logging via SLF4J on
> method & constructor entry & exit & variable change. I'll put it up
> as an enhancement JIRA once I've done a little more work on it.
>
> Rob
>
> ----- Original Message -----
> From: "Thorbjørn Ravn Andersen" <thunderaxiom at gmail.com>
> To: "logback developers list" <logback-dev at qos.ch>
> Sent: Saturday, 26 July, 2008 8:50:07 AM GMT +00:00 GMT Britain, Ireland, Portugal
> Subject: Re: [logback-dev] Least-effort logging with bytecode modification
>
> Ramon Nogueira skrev den 26-07-2008 05:01:
>
>> I thought of implementing this with AspectJ but its probably easier to
>> just use ASM directly for such a simple case.
>>
>> Any ideas/suggestions/precedents?
>>
>>
> You might find
> http://today.java.net/pub/a/today/2008/04/24/add-logging-at-class-load-time-with-instrumentation.html
> interesting (I wrote it) as it describes how to add entry and exit
> logging statements to existing code at load time.
>
>
_______________________________________________
logback-dev mailing list
logback-dev at qos.ch
http://qos.ch/mailman/listinfo/logback-dev
More information about the logback-dev
mailing list