Skip to content

Commit

Permalink
Merge pull request #280 from tony19/wip/2.0.1
Browse files Browse the repository at this point in the history
fix: allow RollingFileAppender to always run
  • Loading branch information
tony19 authored Nov 6, 2022
2 parents 0c5b195 + 69e6b35 commit 07c6bcd
Show file tree
Hide file tree
Showing 67 changed files with 30 additions and 1,371 deletions.
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ buildscript {

repositories {
google()
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
Expand All @@ -27,7 +27,7 @@ apply from: 'gradle/readme.gradle'
allprojects {
repositories {
google()
jcenter()
mavenCentral()
maven { url 'https://oss.sonatype.org/content/repositories/snapshots' }
}
apply from: "${rootProject.projectDir}/gradle/license.gradle"
Expand Down
4 changes: 2 additions & 2 deletions logback-android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ apply from: "${rootProject.projectDir}/gradle/docs.gradle"
apply from: "${rootProject.projectDir}/gradle/deploy.gradle"

android {
compileSdkVersion 30
compileSdkVersion 31

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_6
Expand All @@ -16,7 +16,7 @@ android {

defaultConfig {
minSdkVersion 9
targetSdkVersion 30
targetSdkVersion 31
versionCode VERSION_CODE.toInteger()
versionName VERSION_NAME
}
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

import ch.qos.logback.classic.LoggerContext;
import ch.qos.logback.core.CoreConstants;
import ch.qos.logback.core.android.AndroidContextUtil;
import ch.qos.logback.core.joran.event.SaxEvent;
import ch.qos.logback.core.joran.spi.ConfigurationWatchList;
import ch.qos.logback.core.joran.spi.JoranException;
Expand Down Expand Up @@ -109,12 +110,13 @@ private void fireDoneReconfiguring() {

private void performXMLConfiguration(LoggerContext lc, URL mainConfigurationURL) {
JoranConfigurator jc = new JoranConfigurator();
jc.setContext(context);
StatusUtil statusUtil = new StatusUtil(context);
jc.setContext(lc);
StatusUtil statusUtil = new StatusUtil(lc);
List<SaxEvent> eventList = jc.recallSafeConfiguration();

URL mainURL = ConfigurationWatchListUtil.getMainWatchURL(context);
URL mainURL = ConfigurationWatchListUtil.getMainWatchURL(lc);
lc.reset();
new AndroidContextUtil().setupProperties(lc);
long threshold = System.currentTimeMillis();
try {
jc.doConfigure(mainConfigurationURL);
Expand Down Expand Up @@ -145,8 +147,8 @@ private void fallbackConfiguration(LoggerContext lc, List<SaxEvent> eventList, U

List<SaxEvent> failsafeEvents = removeIncludeEvents(eventList);
JoranConfigurator joranConfigurator = new JoranConfigurator();
joranConfigurator.setContext(context);
ConfigurationWatchList oldCWL = ConfigurationWatchListUtil.getConfigurationWatchList(context);
joranConfigurator.setContext(lc);
ConfigurationWatchList oldCWL = ConfigurationWatchListUtil.getConfigurationWatchList(lc);
ConfigurationWatchList newCWL = oldCWL.buildClone();

if (failsafeEvents == null || failsafeEvents.isEmpty()) {
Expand All @@ -155,7 +157,8 @@ private void fallbackConfiguration(LoggerContext lc, List<SaxEvent> eventList, U
addWarn(FALLING_BACK_TO_SAFE_CONFIGURATION);
try {
lc.reset();
ConfigurationWatchListUtil.registerConfigurationWatchList(context, newCWL);
new AndroidContextUtil().setupProperties(lc);
ConfigurationWatchListUtil.registerConfigurationWatchList(lc, newCWL);
joranConfigurator.doConfigure(failsafeEvents);
addInfo(RE_REGISTERING_PREVIOUS_SAFE_CONFIGURATION);
joranConfigurator.registerSafeConfiguration(eventList);
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@

public class HardenedLoggingEventInputStream extends HardenedObjectInputStream {

static final String ARRAY_PREFIX = "[L";

static public List<String> getWhilelist() {
List<String> whitelist = new ArrayList<String>();
whitelist.add(LoggingEventVO.class.getName());
Expand Down

This file was deleted.

Loading

0 comments on commit 07c6bcd

Please sign in to comment.