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, vba...@gmail.com 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 >> >> >> On 11/21/2017 06:36 PM, vba...@gmail.com 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 bitcoinj+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.