Skip to content

Commit

Permalink
Added log4j.xml config file
Browse files Browse the repository at this point in the history
  • Loading branch information
StanAccy committed Jan 16, 2014
1 parent 0b359e6 commit dbfb8a7
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,15 @@
import org.cowboycoders.ant.messages.DeviceInfoQueryable;
import org.cowboycoders.ant.messages.SlaveChannelType;
import org.cowboycoders.ant.messages.data.BroadcastDataMessage;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.logging.ConsoleHandler;
import java.util.logging.Level;

public class ContinuousScanModeHRM
{

private static final Logger log = LoggerFactory.getLogger( ContinuousScanModeHRM.class );
private static class Listener implements BroadcastListener<BroadcastDataMessage>
{

Expand All @@ -38,11 +40,10 @@ public void receiveMessage( BroadcastDataMessage message )
* should be converted to ints for any arithmetic / display - getUnsignedData()
* is a utility method to do this.
*/
System.out.println( "Heart rate: " + message.getUnsignedData()[7] );
log.info( "Heart rate: " + message.getUnsignedData()[7] );
if( message instanceof DeviceInfoQueryable )
{
System.out.println( "deviceID: " + ((DeviceInfoQueryable) message).getChannelId().getDeviceNumber() );
System.out.println();
log.info( "deviceID: " + ((DeviceInfoQueryable) message).getChannelId().getDeviceNumber() );
}
}

Expand Down
27 changes: 27 additions & 0 deletions jformica-java/src/main/resources/log4j.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">

<log4j:configuration>

<appender name="console" class="org.apache.log4j.ConsoleAppender">
<param name="Target" value="System.out"/>
<layout class="org.apache.log4j.EnhancedPatternLayout">
<param name="ConversionPattern" value="%d{ISO8601}{GMT} %-5p [%t] %c - %m%n"/>
</layout>
</appender>

<logger name="com">
<level value="all"/>
</logger>

<logger name="org">
<level value="all"/>
</logger>


<root>
<priority value="all"/>
<appender-ref ref="console"/>
</root>

</log4j:configuration>

0 comments on commit dbfb8a7

Please sign in to comment.