我试图实现的logback-机器人,我都遵循相同的步骤,这里所描述 in logback android的logback-机器人实现机器人没有发生
我关于这些代码是
<configuration>
<!-- Create a file appender for a log in the application's data directory -->
<appender name="file" class="ch.qos.logback.core.RollingFileAppender">
<file>/sdcard/log/foo.log</file>
<encoder>
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
</encoder>
</appender>
<!-- Write INFO (and higher-level) messages to the log file -->
<root level="INFO">
<appender-ref ref="file" />
</root>
</configuration>
我的活动代码是
public class MainActivity extends Activity {
static private final Logger LOG =
LoggerFactory.getLogger(MainActivity.class);
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
BasicLogcatConfigurator.configureDefaultContext();
LOG.info("Hello Android!");
LOG.debug("reply: {}", Example.hello());
}
static class Example {
static private final Logger LOG =
LoggerFactory.getLogger(Example.class);
static public String hello() {
LOG.trace("entered hello()");
return "Hi there!";
}
}
}
我还在Android清单中使用外部存储权限 我正在使用模拟器创建一个10 MB sdcard文件夹。 但当我运行此代码没有文件和文件夹内创建。 需要帮助就在那里我得到错误的感谢