Merge pull request #73 from danielegobbetti/remove_activity_logfile

Remove the activity log debug file.
This commit is contained in:
Andreas Shimokawa 2015-06-13 00:11:40 +02:00
commit 818399b157
3 changed files with 10 additions and 41 deletions

View File

@ -28,30 +28,6 @@
</encoder>
</appender>
<appender name="ACTIVITY-FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${GB_LOGFILES_DIR}/activity.log</file>
<lazy>true</lazy>
<!-- encoders are by default assigned the type
ch.qos.logback.classic.encoder.PatternLayoutEncoder -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${GB_LOGFILES_DIR}/gadgetbridge-%d{yyyy-MM-dd}.log.zip</fileNamePattern>
<maxHistory>10</maxHistory>
</rollingPolicy>
<triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
<maxFileSize>5MB</maxFileSize>
</triggeringPolicy>
<encoder>
<!--<pattern>%date %level [%thread] %logger{10} [%file:%line] %msg%n</pattern>-->
<pattern>%d{HH:mm:ss.SSS} %msg%n</pattern>
<!--<pattern>%date [%thread] %-5level %logger{25} - %msg%n</pattern>-->
</encoder>
</appender>
<logger name="activity" level="DEBUG" additivity="false">
<appender-ref ref="ACTIVITY-FILE" />
</logger>
<root level="DEBUG">
<appender-ref ref="STDOUT" />
<appender-ref ref="FILE" />

View File

@ -45,13 +45,15 @@ public class GBApplication extends Application {
}
private void setupLogging() {
if (isFileLoggingEnabled()) {
File dir = getExternalFilesDir(null);
if (dir != null && !dir.exists()) {
dir.mkdirs();
}
// used by assets/logback.xml since the location cannot be statically determined
System.setProperty("GB_LOGFILES_DIR", dir.getAbsolutePath());
if (!isFileLoggingEnabled()) {
} else {
System.setProperty("GB_LOGFILES_DIR", "/dev/null"); // just to please logback configuration, not used at all
try {
ch.qos.logback.classic.Logger root = (ch.qos.logback.classic.Logger) LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME);
root.detachAppender("FILE");

View File

@ -49,7 +49,6 @@ import static nodomain.freeyourgadget.gadgetbridge.miband.MiBandConst.getNotific
public class MiBandSupport extends AbstractBTLEDeviceSupport {
private static final Logger LOG = LoggerFactory.getLogger(MiBandSupport.class);
private static final Logger ACTIVITYLOG = LoggerFactory.getLogger("activity");
//temporary buffer, size is a multiple of 60 because we want to store complete minutes (1 minute = 3 bytes)
private static final int activityDataHolderSize = 60 * 24; // 8h
@ -453,7 +452,6 @@ public class MiBandSupport extends AbstractBTLEDeviceSupport {
}
private void handleActivityNotif(byte[] value) {
LOG.info("handleActivityNotif GOT " + value.length + " BYTES.");
if (value.length == 11 ) {
// byte 0 is the data type: 1 means that each minute is represented by a triplet of bytes
int dataType = value[0];
@ -534,13 +532,6 @@ public class MiBandSupport extends AbstractBTLEDeviceSupport {
intensity,
steps,
category);
ACTIVITYLOG.info(
" timestamp:"+DateFormat.getDateTimeInstance().format(timestamp.getTime()).toString() +
" category:"+ category+
" intensity:"+intensity+
" steps:"+steps
);
timestamp.add(Calendar.MINUTE, 1);
}
}