-
Notifications
You must be signed in to change notification settings - Fork 3
Logging Basic Usage
Seppel Hardt edited this page Mar 11, 2019
·
1 revision
Make a Project Add the dependency to your project. Please refer to mgc.common for required maven dependencies and maven reposity URLs.
<dependency>
<groupId>de.micromata.mgc</groupId>
<artifactId>de.micromata.mgc.logging</artifactId>
<version>${mgc.version}</version>
</dependency>
Look for the current version.
If nothing different is configured, Log4J will be used to write the logs. If you want to see something, you have to provide a Log4J configuration. Put a log4j.properties in your class Path. Sample for a unittest src/test/resources/log4j.properties
log4j.rootCategory=INFO, A1
log4j.logger.de.micromata.genome.logging=DEBUG
# A1 is set to be a ConsoleAppender.
log4j.appender.A1=org.apache.log4j.ConsoleAppender
log4j.appender.A1.layout=org.apache.log4j.PatternLayout
log4j.appender.A1.layout.ConversionPattern=T=[%d] F=[%C{1}] L=[%p] X=[%x] M=[%m]%n
A very simple log.
import org.junit.Test;
import de.micromata.genome.logging.GLog;
import de.micromata.genome.logging.GenomeLogCategory;
import de.micromata.genome.logging.LogExceptionAttribute;
public class BaseLoggingTest
{
@Test
public void testLog()
{
GLog.note(GenomeLogCategory.UnitTest, "A Log");
}
}