Change the code to use slf4j loggers everywhere.
Reasons:
- We have Mojo code which uses the Mojo logger
- We have other code which uses a Plexus logger
- We have code used from both places which would benefit from logging and jumps to hoops to make it happen.
If we used the underlying slf4j logging framework directly, every part of the code could use the same logger type and everyone could ask for a logger (right now, you have to have it injected via Plexus or call getLog() in the Mojo), eliminating the need to get loggers and then pass them around.
Changes: Get a logger using this code at the top of a class which needs logging:
private final Logger LOG = LoggerFactory.getLogger( getClass() );
or using
private static final Logger LOG = LoggerFactory.getLogger( TypeName.class );
Note: The latter is slightly faster but if you forget to replace the type name, the logger will have the wrong name.
Additional advantage: If you enable logger names in the log output, you can find places where some message was logged much more quickly.
Change the code to use slf4j loggers everywhere.
Reasons:
If we used the underlying slf4j logging framework directly, every part of the code could use the same logger type and everyone could ask for a logger (right now, you have to have it injected via Plexus or call getLog() in the Mojo), eliminating the need to get loggers and then pass them around.
Changes: Get a logger using this code at the top of a class which needs logging:
or using
Note: The latter is slightly faster but if you forget to replace the type name, the logger will have the wrong name.
Additional advantage: If you enable logger names in the log output, you can find places where some message was logged much more quickly.