[slf4j-dev] slf4j-migrator patch for JUL

Andy Jewell ajewell at adaptu.com
Fri Aug 5 20:00:49 CEST 2011


HI. . .  I had a lot of JUL logp code to convert to SLF4J so I tweaked the
migrator in a few ways:

* Added MultiLineConversionRule to accommodate cases such as:
   log.logp(Level.FINEST, MyClass.class.getName(),
 "myMethod", "Log entry");
* Passed Reader into LineConverter in order to more easily control reading
in of additional lines
* Changed ConversionRule.replace() to append the match.group(1) text to the
replacement line if group(1) exists
* Added additional SingleConversionRules to accommodate additional logp
scenarios

I converted quite a bit of code with minimal cleanup.  Where that was
necessary was pretty unavoidable:

* Code using Level, handlers, custom configuration, etc
* Log entries with commas get a bit mungled, e.g.:
   log.logp(Level.FINEST, MyClass.class.getName(),
"myMethod", "This, e.g., would get mungled");

I did not do any regression testing but it worked in my case.  Attaching the
patch file in case I'm not the only slf4j fan converting logps!

Andy






-- 
*Andy Jewell  *
*Build Engineer
*503.752.6137 | ajewell at adaptu.com <http://twitter.com/bite4size>

Become your household CFO, visit Adaptu.com <https://www.adaptu.com/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://qos.ch/pipermail/slf4j-dev/attachments/20110805/8a833160/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: jullog.patch
Type: text/x-patch
Size: 17938 bytes
Desc: not available
URL: <http://qos.ch/pipermail/slf4j-dev/attachments/20110805/8a833160/attachment-0001.bin>


More information about the slf4j-dev mailing list