Great, thanks for helping!

On 11/22/2017 11:42 AM, [email protected] wrote:
> After several hours trying to configure different logging
> implementations I figured out how to do it.
> I explain what I did, in order to help others in the same situation,
> wanting to configure a very simple logging system in a file, instead
> that logging in the console.
> 
> Procedure:
> 
> - Information from: https://logback.qos.ch/manual/configuration.html
> - IDE: IntelliJ
> - Specific logging implementation: logback
> - I added the following jars through maven: logback-core-1.2.3.jar,
> logback-classic-1.2.3.jar, slf4j-api-1.7.24.jar
> - In my src directory I added the file: logback.xml with the following
> content:
> 
> <configuration>
>     <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
> <encoder>
>             <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - 
> %msg%n</pattern>
>         </encoder>
>     </appender>
>     <appender name="FILE" class="ch.qos.logback.core.FileAppender">
>         <file>myApp.log</file>
>         <encoder>
>             <pattern>%date %level [%thread] %logger{10} [%file:%line] 
> %msg%n</pattern>
>         </encoder>
>     </appender>
>     <root level="debug">
>         <appender-ref ref="FILE" />
>         <!--appender-ref ref="STDOUT" /-->
> </root>
> </configuration>
> 
> - The logs get stored in the fileĀ  myApp.log
> - Uncommenting the lineĀ  <!--appender-ref ref="STDOUT" /--> would also
> print the log in the console.
> - If you want to log more information besides the one being logged by
> bitcoinj you can do it declaring a new variable in the class that you
> want to write the logs
> 
> static final Logger LOG = LoggerFactory.getLogger(<<Name of the 
> class>>.class);
> 
> - When you want to log some info doing something like:
> 
> LOG.trace("Hello World!");
> 
> 
> I hope this helps.
> Kind regards!
> 
> 
> On Tuesday, November 21, 2017 at 8:03:51 PM UTC+1, [email protected] wrote:
> 
>     Thanks Andreas.
>     I read some indications there as well, but I couldn't figure out how
>     to configure it using slf4j with IntelliJ. Do you know if there is
>     something more specific?
> 
>     On Tuesday, November 21, 2017 at 7:17:19 PM UTC+1, Andreas
>     Schildbach wrote:
> 
>         It depends on the environment your app runs in. Bitcoinj uses
>         SLF4J for
>         logging. You need to include a suitable logging implementation,
>         e.g.
>         logback. See https://logback.qos.ch/documentation.html
>         <https://logback.qos.ch/documentation.html>
> 
> 
>         On 11/21/2017 06:36 PM, [email protected] wrote:
>         > I have been trying to put all the logs to a file instead of
>         showing them in
>         > the console, but after trying different things that I found on
>         the Internet
>         > I couldn't make it. Can anybody point me a guide?
>         >
>         > Kind regards!
>         >
> 
> 
> -- 
> You received this message because you are subscribed to the Google
> Groups "bitcoinj" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to [email protected]
> <mailto:[email protected]>.
> For more options, visit https://groups.google.com/d/optout.


-- 
You received this message because you are subscribed to the Google Groups 
"bitcoinj" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to