I've created a provider (jlog) that will convert logging actions in both the 
java.util.logging and log4j APIs in to DTrace events. My main thought was that 
even though USDT is coming to Java in the future the Java industry has already 
been putting user defined trace points in their code for years in the form of 
logging statements. By adding a new java.util.logging Handler or a log4j 
Appender that fires DTrace probes thousands of applications can be traced with 
zero code modification. I've only tested on JDK 1.4 but it should work for any 
Solaris 10 compatible JDK (I'll try mac in the future) See the README.txt 
included in the download for more details.

Download from: http://www.osdev.org/dtrace/

To use:
        Provider should be: jlog* or jlog123 (where 123 is a pid)
        Module will always be: libjlog.so
        Probefunc will be one of the following:
        (depending on which logging API and level that was used)
                severe, warning, config, info, fine, finer, finest
                fatal, error, warn, info, debug, trace
        Probename will be either log-util or log-4j

        arg0 = *char [logger name]
        arg1 = *char [the log message]
        arg2 = *char [source class name]
        arg3 = *char [source method name]

An example of running the included sample script:
# ./src/test.d 
jlog3404:libjlog.so:info:log-4j
        Logger: org.osdev.dtrace
        Message: Hello Java-DTrace-Logging World!
        Class: org.osdev.dtrace.TestAppender
        Method: main

Feedback and bug reports welcome.


--
This message posted from opensolaris.org
_______________________________________________
dtrace-discuss mailing list
[email protected]

Reply via email to