Details
-
Improvement
-
Resolution: Unresolved
-
None
-
None
-
None
-
Operating System: other
Platform: Other
-
enhancement
-
P3
-
231
Description
The SLF4J Android port should provide means to completely turn of logging (for performance reasons, for production use). This issue is intended primarily for discussing the different options for a solution.
There are at least three ways how it could be achieved:
First, by deactivating all logging related method calls when compiling an application. Obviously, this would be tedious if done manually and should therefore be automated by some kind of scripting and be part of the build process.
Second, by a "null" logger implementation that can be used instead of the standard one (which delegates to Android Log). The downside here is that logging is not entirely deactivated since the application code is compiled unchanged, hence, there is still (more or less) logging overhead. Also, the question is how should we switch between the two: programmatically or externally configurable?
A third option is to distribute two different JARs, one for debugging purposes, another one for production use. The difference between the two JARs is that the former contains the standard logger, while the latter contains a null logger. This would be easily integratable in a Maven-managed build process: one can define two profiles, say "dev" and "rel". The latter would define a dependency using a classifier referring to the null-logger JAR whereas the former would define a dependency to the JAR containing the default logger. However, this approach has the same downside than the second one.