1
0
mirror of https://github.com/arduino/Arduino.git synced 2024-12-01 12:24:14 +01:00

Add log4j configuration

This commit is contained in:
Mattia Bertorello 2019-07-03 15:25:48 +02:00
parent 53be417989
commit 2596ecee28
No known key found for this signature in database
GPG Key ID: CE1FB2BE91770F24
2 changed files with 32 additions and 1 deletions

29
app/src/log4j2.xml Normal file
View File

@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="warn" name="Arduino" packages="cc.arduino">
<Appenders>
<!-- Console Appender -->
<Console name="Console" target="SYSTEM_ERR">
<PatternLayout pattern="%d{yyyy-MM-dd'T'HH:mm:ss.SSSXXX}{UTC} %p %c{1.} [%t] %m%n" />
</Console>
<!-- Rolling File Appender -->
<RollingFile name="RollingFile" fileName="${sys:log4j.saveDirectory}/logs/application.log"
filePattern="${sys:log4j.saveDirectory}/logs/application-%d{MM-dd-yyyy}-%i.log.gz"
ignoreExceptions="false">
<PatternLayout>
<Pattern>%d{yyyy-MM-dd'T'HH:mm:ss.SSSXXX}{UTC} %p %c{1.} [%t] %m%n</Pattern>
</PatternLayout>
<Policies>
<SizeBasedTriggeringPolicy size="50 MB"/>
</Policies>
<DefaultRolloverStrategy max="20"/>
</RollingFile>
</Appenders>
<Loggers>
<Root level="debug">
<AppenderRef ref="Console" level="info" />
<AppenderRef ref="RollingFile"/>
</Root>
</Loggers>
</Configuration>

View File

@ -207,6 +207,8 @@ public class Base {
BaseNoGui.getPlatform().init();
BaseNoGui.initPortableFolder();
// This configure the logs root folder
System.setProperty("log4j.saveDirectory", BaseNoGui.getSettingsFolder().getAbsolutePath());
// Look for a possible "--preferences-file" parameter and load preferences
BaseNoGui.initParameters(args);
@ -287,7 +289,7 @@ public class Base {
final GPGDetachedSignatureVerifier gpgDetachedSignatureVerifier = new GPGDetachedSignatureVerifier();
contributionInstaller = new ContributionInstaller(BaseNoGui.getPlatform(), gpgDetachedSignatureVerifier);
libraryInstaller = new LibraryInstaller(BaseNoGui.getPlatform());
libraryInstaller = new LibraryInstaller(BaseNoGui.getPlatform(), gpgDetachedSignatureVerifier);
parser.parseArgumentsPhase2();