Archive

Posts Tagged ‘logging’

Provide log4j configuration fast and dirty

No Gravatar
If you are developing with Java, I’m sure you ran into a console output that looks like this:
log4j:WARN No appenders could be found for logger (org.apache.openejb.resource.activemq.ActiveMQResourceAdapter).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN No appenders could be found for logger (org.apache.openejb.resource.activemq.ActiveMQResourceAdapter).log4j:WARN Please initialize the log4j system properly.
The message is clean: provide a log4j configuration. But, hey, I just want to debug/test/… it… Or I just want to change the debug level, but I cannot modify the app, or cannot find the (right) configuration…
I just need a fast solution for this.
So here it is:
  1. Create a folder and place a log4j.properteies file in it.
  2. Edit your log4j.properteies for your needs.
  3. Add the given folder to your apps classpath (as a first entry)

That’s it.

Read more…

Share

Commons Logging templates for Eclipse

No Gravatar

After my last article some folks at the company I work for asked for a Apache Commons Logging version of templates, so here it is.

Just as with the last article, import this templates: clogger-templates

The mappings are (in case you would like to use with SLF4J):

cloggercreate a logger instance with imports
cloginfocreate log entry of info level
clogerrorcreate log entry of error level
clogwarncreate log entry of warn level
clogtracecreate log entry of trace level
clogdebugcreate log entry of debug level
clogfatalcreate log entry of fatal level

Have fun.

Share

SLF4J Eclipse templates

No Gravatar

I’m sure lot of Eclipse developers are happy with Log4E, but for those who does not have Log4E or do not like to “pollute” Eclipse with plugins, I wrote few templates for SLF4J logging.

Just open Preferences and navigate to Java>Editor>Templates

Eclipse Preferences

Eclipse Preferences

…and press Import… button. And import: slf4j-eclipe-templates (download this file first)

Hit OK. Read more…

Share