Menu

g-logger

G-Logger

Home


Installation

See home page, Installation section, to add maven repositories.

Add in your pom.xml the dependency artifacts.

<dependency>
        <groupId>net.sf.gee</groupId>
        <artifactId>g-logger</artifactId>
        <version>${g-logger.version}</version>
</dependency>

Documentation

UML

FULL Class Diagram
Full description of classes with methods and attributes.

BRIEF Class Diagram
Bird-View of classes.

Site Archive with Javadocs

FInd the site generation of Maven with all informations about project and code, including Javadocs. Please see the Files section and choose your version and download site archive.

Site archive file has name as <libraryname>-<library_version>-SITE.tar.bz2

Example

Configuration File

G-logger use a configuration file to auto-configure itself. Put in your classpath one text file named glog.properties and see the options below:

glog.logger.type = UTIL, LOG4J, SLF4J
glog.logger.file = <FILE_PATH_INSIDE_CLASSPATH>

Examples :

java.util.logging

glog.logger.type = UTIL
glog.logger.file = my-java-util-file.properties

org.apache.log4j

glog.logger.type = LOG4J
glog.logger.file = resources/my-log4j-file.properties

or

glog.logger.file = custom-log4j.xml

org.slf4j

glog.logger.type = SLF4J
glog.logger.file = my-config-with-slf4j.properties

GLogFactory

Log factory singleton that create dynamically your preferred logger.

GLogFactory.getInstance().getLogger( LOGGER.class, CLASS_TO_LOG.class );
GLogFactory.getInstance().getLogger( LOGGER.class, CLASS_TO_LOG.class, YourFormatter );

example

GLogFactory.getInstance().getLogger(SimpleLogger.class, MyCustomClass.class );

or

GLogFactory.getInstance().getLogger(SimpleLogger.class, MyCustomClass.class, new MyCustomerFormatter() );

SImpleGLogger

The net.sf.gee.logger.log.SimpleGLogger is the standard logger that have as output a String. Use net.sf.gee.logger.formatter.StringFormatter.

The example of usage for this class:

final SimpleGLogger logger = GLogFactory.getInstance().getLogger(SimpleLogger.class, MyCustomClass.class);

Your Customization

Decide output class and craete a customer Logger

  • Create your class
    public class YourLogger extends AbstractGLogger<YourOutput> implements GLogger<YourOutput> ...

  • Create your formatter
    public class YourFormatter implements Formatter<YourOutput>


Home