Loggifier.unkrig.de / Tools / Command line tool

From unkrig.de
Jump to navigation Jump to search

Running the LOGGIFIER command line tool with the '-help' option explains its usage:

 Implants logging code into Java class files, and also into class files in
 directory trees, ZIP format files (.zip, .jar, .war, .ear, ...) and nested ZIP
 format files (e.g. .war in .ear).
 
 Usage:
   java de.unkrig.loggifier.Main [ <option> ] ... <file-or-dir>
 Transforms the given <file-or-dir> in-place.
   java de.unkrig.loggifier.Main [ <option> ] ... <file-or-dir> ... <dir>
 Transforms the given <file-or-dir>s into files-and-dirs with the same names in <dir>.
   java de.unkrig.loggifier.Main [ <option> ] ... <file-or-dir> <file-or-new-dir>
 Transforms the given <file-or-dir> into <file-or-new-dir>.
 
 Valid options:
   -help           Shows this text.
   -keep           Keep copies of original files (iff transforming in-place).
   -selector <glob>
                   Loggify only classes matching the <glob>.
   -logging-system <id>
                   Style of the logging code to inject.
                   <id> is 'jre14', 'log4j', 'log4j2' or 'slf4j'. The default is
                   to guess, based on the classes on the classpath.
   -rule <rule>    Add the given loggification rule (format see below).
   -nowarn -quiet -verbose -debug
   -log <level>:<logger>:<handler>:<formatter>:<format>
                   Configure the log output of this command line tool.

 The loggification rule format is as follows:
   <action>[,<action>]...=<level>[:<expression>]
 
 <action>:     One of [ALOAD, ARITH, ASTORE, CAST, CATCH, CLINIT, CONST,
               CONVERT, ENTRY, GET, INVOKE, INSTANCEOF, LENGTH,
               LOAD, NEW, PUT, RESULT, RETURN, STORE, SWITCH, THROW].
 <level>:      One of [OFF SEVERE WARNING INFO CONFIG FINE FINER FINEST].
 <expression>: E.g. '(<eq> || <eq>) && !<eq>', where
 <eq>:         '<var> == <glob>', where
 <var>:        is one of [action source classAccess class methodAccess method
               line type classAndField variable].
               For actions [CAST INSTANCEOF NEW] also 'type'.
               For actions [GET PUT] also 'classAndField'.
               For actions [LOAD STORE] also 'name'.
 <glob>:       is a 'glob pattern' in single quotes like '*main*'.
 
 The exit status is 1 iff errors occurred during loggification.