Uploaded image for project: 'Log Tool'
  1. Log Tool
  2. LOGTOOL-34

FQCN methods are not completely correct

This issue belongs to an archived project. You can view it, but you can't modify it. Learn more

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 1.0.0.CR3
    • 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:

      1. Removal of extra parens around level and arg expressions
      2. Rename arg0 to "format" or "message" as appropriate
      3. Use log.log instead of log.logv for debug(Object) impl (debugv->logv, debugf->logf, debug->log)
      4. Eliminate the toString on params (especially varargs which won't work at all)
      5. Rename arg1..n to "param1..n" to be consistent with the declaration
      6. Rename arg1 to "params" on varargs methods
      7. Shortened "org.jboss.logging.Logger.Level" to "Logger.Level" in parameter lists
      8. 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)

              dlloyd@redhat.com David Lloyd
              dlloyd@redhat.com David Lloyd
              Archiver:
              rhn-support-sthamilt Stacey Hamilton

                Created:
                Updated:
                Resolved:
                Archived: