├── README.md
├── adsense-gadget-bottom.xml
├── adsense-gadget-middle.xml
├── adsense-gadget-top.xml
├── pom.xml
└── src
├── main
└── java
│ └── de
│ └── mindpipe
│ └── android
│ └── logging
│ └── log4j
│ ├── LogCatAppender.java
│ └── LogConfigurator.java
└── test
└── java
└── de
└── mindpipe
└── android
└── logging
└── log4j
├── LogConfiguratorTest.java
└── example
├── ConfigureLog4J.java
├── ExampleLog4J.java
└── ExampleLog4JOverSLF4J.java
/README.md:
--------------------------------------------------------------------------------
1 | Mirror of https://code.google.com/p/android-logging-log4j/
2 |
3 | With changes to work with latest version of log4j
4 |
--------------------------------------------------------------------------------
/adsense-gadget-bottom.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
13 |
14 |
17 | ]]>
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/adsense-gadget-middle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
13 |
14 |
17 | ]]>
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/adsense-gadget-top.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
13 |
14 |
17 | ]]>
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/pom.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 | 4.0.0
18 |
19 |
20 | org.sonatype.oss
21 | oss-parent
22 | 7
23 |
24 |
25 | de.mindpipe.android
26 | android-logging-log4j
27 | 1.0.4-SNAPSHOT
28 | jar
29 |
30 | android-logging-log4j
31 | http://code.google.com/p/android-logging-log4j/
32 |
33 | Logging with log4j in Android. Provides log4j configuration facade class and a LogCat appender.
34 |
35 |
36 | http://code.google.com/p/android-logging-log4j/issues/
37 |
38 |
39 |
40 | UTF-8
41 |
42 |
43 |
44 |
45 | rolf.kulemann
46 | Rolf Kulemann
47 | https://www.xing.com/profile/Rolf_Kulemann
48 |
49 | owner
50 | developer
51 |
52 |
53 |
54 | pascal@bockhorn.it
55 | Pascal Bockhorn
56 |
57 | developer
58 |
59 |
60 |
61 | sean.robert.wagner
62 | Sean Robert Wagner
63 |
64 | developer
65 |
66 |
67 |
68 |
69 |
70 |
71 | Apache License 2.0
72 | http://www.apache.org/licenses/LICENSE-2.0
73 |
74 |
75 |
76 |
77 | scm:svn:https://android-logging-log4j.googlecode.com/svn/trunk/
78 | scm:svn:https://android-logging-log4j.googlecode.com/svn/trunk/
79 | http://svn.sonatype.org/spice/tags/oss-parent-7/android-logging-log4j
80 |
81 |
82 |
83 |
84 | junit
85 | junit
86 | 4.8.2
87 | test
88 |
89 |
90 |
91 | org.apache.commons
92 | commons-io
93 | 1.3.2
94 | test
95 |
96 |
97 |
98 | com.google.android
99 | android
100 | 2.3.3
101 | provided
102 |
103 |
104 |
105 | org.slf4j
106 | slf4j-api
107 | 1.6.4
108 | provided
109 |
110 |
111 | org.slf4j
112 | slf4j-log4j12
113 | 1.6.4
114 | provided
115 |
116 |
117 |
118 | log4j
119 | log4j
120 | 1.2.16
121 | provided
122 |
123 |
124 |
125 |
126 |
127 |
128 | org.apache.maven.plugins
129 | maven-compiler-plugin
130 | 2.3.2
131 |
132 | 1.6
133 | 1.6
134 |
135 |
136 |
137 |
138 | org.apache.maven.plugins
139 | maven-gpg-plugin
140 |
141 |
142 | sign-artifacts
143 | verify
144 |
145 | sign
146 |
147 |
148 |
149 |
150 |
151 |
152 | org.apache.maven.plugins
153 | maven-javadoc-plugin
154 | 2.8
155 |
156 |
157 | attach-javadocs
158 |
159 | jar
160 |
161 |
162 |
163 |
164 |
165 |
166 |
167 |
--------------------------------------------------------------------------------
/src/main/java/de/mindpipe/android/logging/log4j/LogCatAppender.java:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2011 Rolf Kulemann, Pascal Bockhorn
3 |
4 | Licensed under the Apache License, Version 2.0 (the "License");
5 | you may not use this file except in compliance with the License.
6 | You may obtain a copy of the License at
7 |
8 | http://www.apache.org/licenses/LICENSE-2.0
9 |
10 | Unless required by applicable law or agreed to in writing, software
11 | distributed under the License is distributed on an "AS IS" BASIS,
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | See the License for the specific language governing permissions and
14 | limitations under the License.
15 | */
16 | package de.mindpipe.android.logging.log4j;
17 |
18 | import org.apache.log4j.AppenderSkeleton;
19 | import org.apache.log4j.Layout;
20 | import org.apache.log4j.Level;
21 | import org.apache.log4j.PatternLayout;
22 | import org.apache.log4j.spi.LoggingEvent;
23 |
24 | import android.util.Log;
25 |
26 | /**
27 | * Appender for {@link Log}
28 | * @author Rolf Kulemann, Pascal Bockhorn
29 | */
30 | public class LogCatAppender extends AppenderSkeleton {
31 |
32 | protected Layout tagLayout;
33 |
34 | public LogCatAppender(final Layout messageLayout, final Layout tagLayout) {
35 | this.tagLayout = tagLayout;
36 | setLayout(messageLayout);
37 | }
38 |
39 | public LogCatAppender(final Layout messageLayout) {
40 | this(messageLayout, new PatternLayout("%c"));
41 | }
42 |
43 | public LogCatAppender() {
44 | this(new PatternLayout("%m%n"));
45 | }
46 |
47 | @Override
48 | protected void append(final LoggingEvent le) {
49 | switch (le.getLevel().toInt()) {
50 | case Level.TRACE_INT:
51 | if (le.getThrowableInformation() != null) {
52 | Log.v(getTagLayout().format(le), getLayout().format(le), le.getThrowableInformation().getThrowable());
53 | }
54 | else {
55 | Log.v(getTagLayout().format(le), getLayout().format(le));
56 | }
57 | break;
58 | case Level.DEBUG_INT:
59 | if (le.getThrowableInformation() != null) {
60 | Log.d(getTagLayout().format(le), getLayout().format(le), le.getThrowableInformation().getThrowable());
61 | }
62 | else {
63 | Log.d(getTagLayout().format(le), getLayout().format(le));
64 | }
65 | break;
66 | case Level.INFO_INT:
67 | if (le.getThrowableInformation() != null) {
68 | Log.i(getTagLayout().format(le), getLayout().format(le), le.getThrowableInformation().getThrowable());
69 | }
70 | else {
71 | Log.i(getTagLayout().format(le), getLayout().format(le));
72 | }
73 | break;
74 | case Level.WARN_INT:
75 | if (le.getThrowableInformation() != null) {
76 | Log.w(getTagLayout().format(le), getLayout().format(le), le.getThrowableInformation().getThrowable());
77 | }
78 | else {
79 | Log.w(getTagLayout().format(le), getLayout().format(le));
80 | }
81 | break;
82 | case Level.ERROR_INT:
83 | if (le.getThrowableInformation() != null) {
84 | Log.e(getTagLayout().format(le), getLayout().format(le), le.getThrowableInformation().getThrowable());
85 | }
86 | else {
87 | Log.e(getTagLayout().format(le), getLayout().format(le));
88 | }
89 | break;
90 | case Level.FATAL_INT:
91 | if (le.getThrowableInformation() != null) {
92 | Log.wtf(getTagLayout().format(le), getLayout().format(le), le.getThrowableInformation().getThrowable());
93 | }
94 | else {
95 | Log.wtf(getTagLayout().format(le), getLayout().format(le));
96 | }
97 | break;
98 | }
99 | }
100 |
101 | @Override
102 | public void close() {
103 | }
104 |
105 | @Override
106 | public boolean requiresLayout() {
107 | return true;
108 | }
109 |
110 | public Layout getTagLayout() {
111 | return tagLayout;
112 | }
113 |
114 | public void setTagLayout(final Layout tagLayout) {
115 | this.tagLayout = tagLayout;
116 | }
117 | }
118 |
--------------------------------------------------------------------------------
/src/main/java/de/mindpipe/android/logging/log4j/LogConfigurator.java:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2011 Rolf Kulemann, Pascal Bockhorn
3 |
4 | Licensed under the Apache License, Version 2.0 (the "License");
5 | you may not use this file except in compliance with the License.
6 | You may obtain a copy of the License at
7 |
8 | http://www.apache.org/licenses/LICENSE-2.0
9 |
10 | Unless required by applicable law or agreed to in writing, software
11 | distributed under the License is distributed on an "AS IS" BASIS,
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | See the License for the specific language governing permissions and
14 | limitations under the License.
15 | */
16 | package de.mindpipe.android.logging.log4j;
17 |
18 | import java.io.IOException;
19 |
20 | import org.apache.log4j.Layout;
21 | import org.apache.log4j.Level;
22 | import org.apache.log4j.LogManager;
23 | import org.apache.log4j.Logger;
24 | import org.apache.log4j.PatternLayout;
25 | import org.apache.log4j.RollingFileAppender;
26 | import org.apache.log4j.helpers.LogLog;
27 |
28 | /**
29 | * Configures the Log4j logging framework.
30 | * See Patterns for pattern layout.
31 | *
32 | * @author Rolf Kulemann
33 | */
34 | public class LogConfigurator {
35 | private Level rootLevel = Level.DEBUG;
36 | private String filePattern = "%d - [%p::%c::%C] - %m%n";
37 | private String logCatPattern = "%m%n";
38 | private String fileName = "android-log4j.log";
39 | private int maxBackupSize = 5;
40 | private long maxFileSize = 512 * 1024;
41 | private boolean immediateFlush = true;
42 | private boolean useLogCatAppender = true;
43 | private boolean useFileAppender = true;
44 | private boolean resetConfiguration = true;
45 | private boolean internalDebugging = false;
46 |
47 | public LogConfigurator() {
48 | }
49 |
50 | /**
51 | * @param fileName Name of the log file
52 | */
53 | public LogConfigurator(final String fileName) {
54 | setFileName(fileName);
55 | }
56 |
57 | /**
58 | * @param fileName Name of the log file
59 | * @param rootLevel Log level for the root logger
60 | */
61 | public LogConfigurator(final String fileName, final Level rootLevel) {
62 | this(fileName);
63 | setRootLevel(rootLevel);
64 | }
65 |
66 | /**
67 | * @param fileName Name of the log file
68 | * @param rootLevel Log level for the root logger
69 | * @param filePattern Log pattern for the file appender
70 | */
71 | public LogConfigurator(final String fileName, final Level rootLevel, final String filePattern) {
72 | this(fileName);
73 | setRootLevel(rootLevel);
74 | setFilePattern(filePattern);
75 | }
76 |
77 | /**
78 | * @param fileName Name of the log file
79 | * @param maxBackupSize Maximum number of backed up log files
80 | * @param maxFileSize Maximum size of log file until rolling
81 | * @param filePattern Log pattern for the file appender
82 | * @param rootLevel Log level for the root logger
83 | */
84 | public LogConfigurator(final String fileName, final int maxBackupSize,
85 | final long maxFileSize, final String filePattern, final Level rootLevel) {
86 | this(fileName, rootLevel, filePattern);
87 | setMaxBackupSize(maxBackupSize);
88 | setMaxFileSize(maxFileSize);
89 | }
90 |
91 | public void configure() {
92 | final Logger root = Logger.getRootLogger();
93 |
94 | if(isResetConfiguration()) {
95 | LogManager.getLoggerRepository().resetConfiguration();
96 | }
97 |
98 | LogLog.setInternalDebugging(isInternalDebugging());
99 |
100 | if(isUseFileAppender()) {
101 | configureFileAppender();
102 | }
103 |
104 | if(isUseLogCatAppender()) {
105 | configureLogCatAppender();
106 | }
107 |
108 | root.setLevel(getRootLevel());
109 | }
110 |
111 | /**
112 | * Sets the level of logger with name loggerName
.
113 | * Corresponds to log4j.properties log4j.logger.org.apache.what.ever=ERROR
114 | * @param loggerName
115 | * @param level
116 | */
117 | public void setLevel(final String loggerName, final Level level) {
118 | Logger.getLogger(loggerName).setLevel(level);
119 | }
120 |
121 | private void configureFileAppender() {
122 | final Logger root = Logger.getRootLogger();
123 | final RollingFileAppender rollingFileAppender;
124 | final Layout fileLayout = new PatternLayout(getFilePattern());
125 |
126 | try {
127 | rollingFileAppender = new RollingFileAppender(fileLayout, getFileName());
128 | } catch (final IOException e) {
129 | throw new RuntimeException("Exception configuring log system", e);
130 | }
131 |
132 | rollingFileAppender.setMaxBackupIndex(getMaxBackupSize());
133 | rollingFileAppender.setMaximumFileSize(getMaxFileSize());
134 | rollingFileAppender.setImmediateFlush(isImmediateFlush());
135 |
136 | root.addAppender(rollingFileAppender);
137 | }
138 |
139 | private void configureLogCatAppender() {
140 | final Logger root = Logger.getRootLogger();
141 | final Layout logCatLayout = new PatternLayout(getLogCatPattern());
142 | final LogCatAppender logCatAppender = new LogCatAppender(logCatLayout);
143 |
144 | root.addAppender(logCatAppender);
145 | }
146 |
147 | /**
148 | * Return the log level of the root logger
149 | * @return Log level of the root logger
150 | */
151 | public Level getRootLevel() {
152 | return rootLevel;
153 | }
154 |
155 | /**
156 | * Sets log level for the root logger
157 | * @param level Log level for the root logger
158 | */
159 | public void setRootLevel(final Level level) {
160 | this.rootLevel = level;
161 | }
162 |
163 | public String getFilePattern() {
164 | return filePattern;
165 | }
166 |
167 | public void setFilePattern(final String filePattern) {
168 | this.filePattern = filePattern;
169 | }
170 |
171 | public String getLogCatPattern() {
172 | return logCatPattern;
173 | }
174 |
175 | public void setLogCatPattern(final String logCatPattern) {
176 | this.logCatPattern = logCatPattern;
177 | }
178 |
179 | /**
180 | * Returns the name of the log file
181 | * @return the name of the log file
182 | */
183 | public String getFileName() {
184 | return fileName;
185 | }
186 |
187 | /**
188 | * Sets the name of the log file
189 | * @param fileName Name of the log file
190 | */
191 | public void setFileName(final String fileName) {
192 | this.fileName = fileName;
193 | }
194 |
195 | /**
196 | * Returns the maximum number of backed up log files
197 | * @return Maximum number of backed up log files
198 | */
199 | public int getMaxBackupSize() {
200 | return maxBackupSize;
201 | }
202 |
203 | /**
204 | * Sets the maximum number of backed up log files
205 | * @param maxBackupSize Maximum number of backed up log files
206 | */
207 | public void setMaxBackupSize(final int maxBackupSize) {
208 | this.maxBackupSize = maxBackupSize;
209 | }
210 |
211 | /**
212 | * Returns the maximum size of log file until rolling
213 | * @return Maximum size of log file until rolling
214 | */
215 | public long getMaxFileSize() {
216 | return maxFileSize;
217 | }
218 |
219 | /**
220 | * Sets the maximum size of log file until rolling
221 | * @param maxFileSize Maximum size of log file until rolling
222 | */
223 | public void setMaxFileSize(final long maxFileSize) {
224 | this.maxFileSize = maxFileSize;
225 | }
226 |
227 | public boolean isImmediateFlush() {
228 | return immediateFlush;
229 | }
230 |
231 | public void setImmediateFlush(final boolean immediateFlush) {
232 | this.immediateFlush = immediateFlush;
233 | }
234 |
235 | /**
236 | * Returns true, if FileAppender is used for logging
237 | * @return True, if FileAppender is used for logging
238 | */
239 | public boolean isUseFileAppender() {
240 | return useFileAppender;
241 | }
242 |
243 | /**
244 | * @param useFileAppender the useFileAppender to set
245 | */
246 | public void setUseFileAppender(final boolean useFileAppender) {
247 | this.useFileAppender = useFileAppender;
248 | }
249 |
250 | /**
251 | * Returns true, if LogcatAppender should be used
252 | * @return True, if LogcatAppender should be used
253 | */
254 | public boolean isUseLogCatAppender() {
255 | return useLogCatAppender;
256 | }
257 |
258 | /**
259 | * If set to true, LogCatAppender will be used for logging
260 | * @param useLogCatAppender If true, LogCatAppender will be used for logging
261 | */
262 | public void setUseLogCatAppender(final boolean useLogCatAppender) {
263 | this.useLogCatAppender = useLogCatAppender;
264 | }
265 |
266 | public void setResetConfiguration(boolean resetConfiguration) {
267 | this.resetConfiguration = resetConfiguration;
268 | }
269 |
270 | /**
271 | * Resets the log4j configuration before applying this configuration. Default is true.
272 | * @return True, if the log4j configuration should be reset before applying this configuration.
273 | */
274 | public boolean isResetConfiguration() {
275 | return resetConfiguration;
276 | }
277 |
278 | public void setInternalDebugging(boolean internalDebugging) {
279 | this.internalDebugging = internalDebugging;
280 | }
281 |
282 | public boolean isInternalDebugging() {
283 | return internalDebugging;
284 | }
285 | }
286 |
--------------------------------------------------------------------------------
/src/test/java/de/mindpipe/android/logging/log4j/LogConfiguratorTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2011 Rolf Kulemann
3 |
4 | Licensed under the Apache License, Version 2.0 (the "License");
5 | you may not use this file except in compliance with the License.
6 | You may obtain a copy of the License at
7 |
8 | http://www.apache.org/licenses/LICENSE-2.0
9 |
10 | Unless required by applicable law or agreed to in writing, software
11 | distributed under the License is distributed on an "AS IS" BASIS,
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | See the License for the specific language governing permissions and
14 | limitations under the License.
15 | */
16 | package de.mindpipe.android.logging.log4j;
17 |
18 | import static org.junit.Assert.*;
19 |
20 | import java.io.File;
21 | import java.io.IOException;
22 |
23 | import org.apache.commons.io.FileUtils;
24 | import org.apache.log4j.Level;
25 | import org.apache.log4j.Logger;
26 | import org.junit.Before;
27 | import org.junit.Test;
28 |
29 | /**
30 | * @author Rolf Kulemann
31 | *
32 | */
33 | public class LogConfiguratorTest {
34 | private LogConfigurator logConfigurator;
35 |
36 | @Before
37 | public void setUp() {
38 | logConfigurator = new LogConfigurator();
39 | }
40 |
41 | @Test
42 | public void testConfigure() {
43 | final Logger log = Logger.getLogger(LogConfiguratorTest.class);
44 | final String message = "This message should be seen in log file and logcat";
45 | final String messageNot = "This message should NOT be seen in log file and logcat";
46 |
47 | // deactivate LogCatAppender, since otherwise we get exception while logging in a non Android environment
48 | logConfigurator.setUseLogCatAppender(false);
49 | logConfigurator.setImmediateFlush(true);
50 | logConfigurator.setLevel("de.mindpipe", Level.TRACE);
51 | logConfigurator.configure();
52 |
53 | log.info(message);
54 |
55 | assertLogFileExists();
56 | assertLogContains(message);
57 |
58 | logConfigurator.setLevel("de.mindpipe", Level.ERROR);
59 | log.info(messageNot);
60 | assertLogNotContains(messageNot);
61 | }
62 |
63 | private void assertLogFileExists() {
64 | assertTrue(new File(logConfigurator.getFileName()).exists());
65 | }
66 |
67 | private void assertLogContains(final String string) {
68 | final String logFileContents = logFileToString();
69 | assertTrue(logFileContents.contains(string));
70 | }
71 |
72 | private void assertLogNotContains(final String string) {
73 | final String logFileContents = logFileToString();
74 | assertFalse(logFileContents.contains(string));
75 | }
76 |
77 | private String logFileToString() {
78 | final String logFileContents;
79 |
80 | try {
81 | logFileContents = FileUtils.readFileToString(new File(logConfigurator.getFileName()));
82 | } catch (final IOException e) {
83 | throw new RuntimeException(e);
84 | }
85 |
86 | return logFileContents;
87 | }
88 | }
89 |
--------------------------------------------------------------------------------
/src/test/java/de/mindpipe/android/logging/log4j/example/ConfigureLog4J.java:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2011 Rolf Kulemann
3 |
4 | Licensed under the Apache License, Version 2.0 (the "License");
5 | you may not use this file except in compliance with the License.
6 | You may obtain a copy of the License at
7 |
8 | http://www.apache.org/licenses/LICENSE-2.0
9 |
10 | Unless required by applicable law or agreed to in writing, software
11 | distributed under the License is distributed on an "AS IS" BASIS,
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | See the License for the specific language governing permissions and
14 | limitations under the License.
15 | */
16 | package de.mindpipe.android.logging.log4j.example;
17 |
18 | import java.io.File;
19 |
20 | import org.apache.log4j.Level;
21 |
22 | import android.os.Environment;
23 | import de.mindpipe.android.logging.log4j.LogConfigurator;
24 |
25 | /**
26 | * Example how to to configure Log4J in Android.
27 | * Call {@link #configure()}} from your application's activity.
28 | * @author Rolf Kulemann
29 | */
30 | public class ConfigureLog4J {
31 | public static void configure() {
32 | final LogConfigurator logConfigurator = new LogConfigurator();
33 |
34 | logConfigurator.setFileName(Environment.getExternalStorageDirectory() + File.separator + "myapp.log");
35 | // Set the root log level
36 | logConfigurator.setRootLevel(Level.DEBUG);
37 | // Set log level of a specific logger
38 | logConfigurator.setLevel("org.apache", Level.ERROR);
39 | logConfigurator.configure();
40 | }
41 | }
--------------------------------------------------------------------------------
/src/test/java/de/mindpipe/android/logging/log4j/example/ExampleLog4J.java:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2011 Rolf Kulemann
3 |
4 | Licensed under the Apache License, Version 2.0 (the "License");
5 | you may not use this file except in compliance with the License.
6 | You may obtain a copy of the License at
7 |
8 | http://www.apache.org/licenses/LICENSE-2.0
9 |
10 | Unless required by applicable law or agreed to in writing, software
11 | distributed under the License is distributed on an "AS IS" BASIS,
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | See the License for the specific language governing permissions and
14 | limitations under the License.
15 | */
16 | package de.mindpipe.android.logging.log4j.example;
17 |
18 |
19 |
20 | import org.apache.log4j.Logger;
21 |
22 | /**
23 | * Demonstrates using log4j directly.
24 | * @author Rolf Kulemann
25 | */
26 | public class ExampleLog4J {
27 | private final Logger log = Logger.getLogger(ExampleLog4J.class);
28 |
29 | public void myMethod() {
30 | log.info("This message should be seen in log file and logcat");
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/src/test/java/de/mindpipe/android/logging/log4j/example/ExampleLog4JOverSLF4J.java:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2011 Rolf Kulemann
3 |
4 | Licensed under the Apache License, Version 2.0 (the "License");
5 | you may not use this file except in compliance with the License.
6 | You may obtain a copy of the License at
7 |
8 | http://www.apache.org/licenses/LICENSE-2.0
9 |
10 | Unless required by applicable law or agreed to in writing, software
11 | distributed under the License is distributed on an "AS IS" BASIS,
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | See the License for the specific language governing permissions and
14 | limitations under the License.
15 | */
16 | package de.mindpipe.android.logging.log4j.example;
17 |
18 | import org.slf4j.Logger;
19 | import org.slf4j.LoggerFactory;
20 |
21 | /**
22 | * Demonstrates using log4j over slf4j.
23 | * @author Rolf Kulemann
24 | */
25 | public class ExampleLog4JOverSLF4J {
26 | private final Logger log = LoggerFactory.getLogger(ExampleLog4JOverSLF4J.class);
27 |
28 | public void myMethod() {
29 | log.info("This message should be seen in log file and logcat");
30 | }
31 | }
32 |
--------------------------------------------------------------------------------