[slf4j-user] How to specify location of file to write log message to?

Chris Pratt thechrispratt at gmail.com
Thu Apr 19 21:38:40 CEST 2012


SLF4j is a Logging Facade, not a logging engine.  So... SLF4j doesn't
actually write out any files.  You need to configure the output file in
your Logging Engine (Log4j, Logback, etc).

Same with setDebugEnabled, since SLF4j is simply a common interface that is
applied to a wide variety of logging engines, it provides the common
facilities (i.e. Least Common Denominator) that are commonly used in
applications that require logging.  If you need something specific to your
logging engine, or something less common, you'll have to use the features
that are part of your chosen engine.
  (*Chris*)

On Thu, Apr 19, 2012 at 9:17 AM, Charles Thomas <Charles.Thomas at argodata.com
> wrote:

>  Sirs:
>
>
>
> I certainly must have overlooked something in the User’s Manual and the
> javadocs looking for the answer to two basic questions.  Please forgive me,
> if the answers are stated in an obvious place.
>
>
>
> First Question - How do I tell slf4j to write log messages from my program
> to the “C:\Application-Log-Files\App1-Log.txt” file?
>
>
>
> Second Question – I see the methods like isDebugEnabled(), but I do not
> see something like setDebugEnabled(true).  How do I tell slf4j to log
> debug-level messages?
>
>
>
> Thank you,
>
> Charles Thomas
>
>
>
> My program:
>
>
>
> *package* com.argo.logtest;
>
>
>
> *import* org.slf4j.Logger;
>
> *import* org.slf4j.LoggerFactory;
>
>
>
>
>
> *public* *class* BasicLogging
>
> {
>
>
>
>       *public* *static* *void* main(String[] args)
>
>       {
>
>             Logger logger = LoggerFactory.*getLogger*("com.argo.logTest");
>
>
>
>             logger.debug("Msg Num {} was {}", 1, "A debug message.");
>
>             logger.info("Msg Num {} was {}", 2, "An info message.");
>
>             logger.error("Msg Num {} was {}", 3, "An error message.");
>
>             logger.warn("Msg Num {} was {}", 4, "A warning message.");
>
>
>
>       }
>
>
>
> }
>
>
>  --------------------------------------------------- Confidentiality
> Notice: This electronic mail transmission is confidential, may be
> privileged and should be read or retained only by the intended recipient.
> If you have received this transmission in error, please immediately notify
> the sender and delete it from your system.
>
> _______________________________________________
> slf4j-user mailing list
> slf4j-user at qos.ch
> http://mailman.qos.ch/mailman/listinfo/slf4j-user
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.qos.ch/pipermail/slf4j-user/attachments/20120419/fd0fbc61/attachment.html>


More information about the slf4j-user mailing list