-
Bug
-
Resolution: Done
-
Major
-
None
-
None
The generated code which looks like this:
// ...snip... @Override public final void log(final org.jboss.logging.Logger.Level arg0, final String arg1, final Object arg2, final Throwable arg3) { log.logv(FQCN, arg0, arg3, arg1, (arg2 == null ? null : arg2.toString())); } @Override public final void debugf(final String arg0, final Object arg1) { log.logf(FQCN, (Logger.Level.DEBUG), null, arg0, (arg1 == null ? null : arg1.toString())); } @Override public final void debugv(final String arg0, final Object arg1) { log.logv(FQCN, (Logger.Level.DEBUG), null, arg0, (arg1 == null ? null : arg1.toString())); } @Override public final void tracef(final String arg0, final Object arg1) { log.logf(FQCN, (Logger.Level.TRACE), null, arg0, (arg1 == null ? null : arg1.toString())); } @Override public final void debug(final Object arg0) { log.logv(FQCN, (Logger.Level.DEBUG), null, (arg0 == null ? null : arg0.toString())); } // ...snip... @Override public final void errorv(final String arg0, Object... arg1) { log.logv(FQCN, (Logger.Level.ERROR), null, arg0, (arg1 == null ? null : arg1.toString())); }
...should look like this:
// ...snip... @Override public final void log(final Logger.Level level, final String loggerFqcn, final Object message, final Throwable cause) { log.log(level, loggerFqcn, message, cause); } @Override public final void debugf(final String format, final Object param1) { log.logf(FQCN, Logger.Level.DEBUG, null, format, param1); } @Override public final void debugv(final String format, final Object param1) { log.logv(FQCN, Logger.Level.DEBUG, null, format, param1); } @Override public final void tracef(final String format, final Object param1) { log.logf(FQCN, Logger.Level.TRACE, null, format, param1); } @Override public final void debug(final Object message) { log.log(FQCN, Logger.Level.DEBUG, message, null, null); } // ...snip... @Override public final void errorv(final String format, Object... params) { log.logv(FQCN, Logger.Level.ERROR, null, format, params); }
Note:
- Removal of extra parens around level and arg expressions
- Rename arg0 to "format" or "message" as appropriate
- Use log.log instead of log.logv for debug(Object) impl (debugv->logv, debugf->logf, debug->log)
- Eliminate the toString on params (especially varargs which won't work at all)
- Rename arg1..n to "param1..n" to be consistent with the declaration
- Rename arg1 to "params" on varargs methods
- Shortened "org.jboss.logging.Logger.Level" to "Logger.Level" in parameter lists
- Made sure that the "loggerFqcn" parameter is properly propagated on those BasicLogger methods which use it (see the corrected log() definition, note that FQCN is not used here)