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.
(In reply to comment #3)
> (In reply to comment #2)
> Anyway, I'm not part of slf4j team, but I guess the use of maven goes far beyond
> the scope of this bugzilla...
Well, Maven is already used by slf4j-android. So it boils down to a simple extension of the POM, which I have already done locally to test it. However, there is an issue with Proguard that has to be sorted out first (it doesn't seem to be happy with the Android JARs that are available from Maven Central).