You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by "Nelson MELINA (JIRA)" <ji...@apache.org> on 2014/07/22 10:25:39 UTC
[jira] [Comment Edited] (LOG4J2-728) Look for log4j2.xml in assets
folder (or the application data) in an Android APK.
[ https://issues.apache.org/jira/browse/LOG4J2-728?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14069996#comment-14069996 ]
Nelson MELINA edited comment on LOG4J2-728 at 7/22/14 8:25 AM:
---------------------------------------------------------------
{noFormat}
System.setProperty("log4j2.disable.jmx", "true");
StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
StrictMode.setThreadPolicy(policy);
Log4J2ConfigurationFactory configLog4J2 = new Log4J2ConfigurationFactory(getAssets());
ConfigurationFactory.setConfigurationFactory(configLog4J2);
logger = LogManager.getLogger();
{noFormat}
This get me a
{noFormat}
Caused by: java.lang.NullPointerException: No Configuration was provided
at org.apache.logging.log4j.core.LoggerContext.setConfiguration(LoggerContext.java:351)
at org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:416)
at org.apache.logging.log4j.core.LoggerContext.start(LoggerContext.java:146)
at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:75)
at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:37)
at org.apache.logging.log4j.LogManager.getLogger(LogManager.java:473)
at org.apache.logging.log4j.LogManager.getLogger(LogManager.java:408)
at com.torointl.log4j2xtest.MyActivity.onCreate(MyActivity.java:35)
{noFormat}
at the " logger = LogManager.getLogger();" line, is there something else i need to do so that it recognize my new configFactory ?
was (Author: daln):
{noFormat]
System.setProperty("log4j2.disable.jmx", "true");
StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
StrictMode.setThreadPolicy(policy);
Log4J2ConfigurationFactory configLog4J2 = new Log4J2ConfigurationFactory(getAssets());
ConfigurationFactory.setConfigurationFactory(configLog4J2);
logger = LogManager.getLogger();
{noFormat}
This get me a
{noFormat}
Caused by: java.lang.NullPointerException: No Configuration was provided
at org.apache.logging.log4j.core.LoggerContext.setConfiguration(LoggerContext.java:351)
at org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:416)
at org.apache.logging.log4j.core.LoggerContext.start(LoggerContext.java:146)
at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:75)
at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:37)
at org.apache.logging.log4j.LogManager.getLogger(LogManager.java:473)
at org.apache.logging.log4j.LogManager.getLogger(LogManager.java:408)
at com.torointl.log4j2xtest.MyActivity.onCreate(MyActivity.java:35)
{noFormat}
at the " logger = LogManager.getLogger();" line, is there something else i need to do so that it recognize my new configFactory ?
> Look for log4j2.xml in assets folder (or the application data) in an Android APK.
> ---------------------------------------------------------------------------------
>
> Key: LOG4J2-728
> URL: https://issues.apache.org/jira/browse/LOG4J2-728
> Project: Log4j 2
> Issue Type: Bug
> Components: Configurators
> Affects Versions: 2.0-rc2
> Environment: Android
> Reporter: Nelson MELINA
> Labels: android
>
> To add files in an Android apk, you need to put them in an assets folder and then they are in an "assets" folder in the APK.
> Log4j 2 needs to find it there when it exists (not the case now).
> Also would it be possible to load the xml configuration file from the application data ( https://developer.android.com/guide/topics/data/data-storage.html ) ?
--
This message was sent by Atlassian JIRA
(v6.2#6252)
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org