Jump to content
We've recently updated our Privacy Statement, available here ×
  • Configuring Apache Commong Logging and Log4J in JSS


    stasp

    Problem

    It may appear tricky to configure logging for solutions like Apache Commons Loggin or Log4J, in Jaspersoft Studio (Professional).

    Solution

    Here below we will see some steps that allows to configure different output files when using Apache Commons Loggin and Log4J. We also specified to have detailed information (log level ALL) when logging is performed by one of the BigData connectors.

    This is only one of the possible scenario. Different solutions can be taken, just modifying the JVM arguments passed or changing the configuration log files.

     

    1. Locate the Jaspersoft Studio installation folder. For example: C:Program FilesJaspersoftJaspersoft Studio Professional-5.5.0.final
    2. Edit the Jaspersoft Studio Professional.ini file and add the following arguments:

      -Dlog4j.configuration=file:/C:/jsslog/config/log4j-config.properties
      -Dorg.apache.commons.logging.diagnostics.dest=C:/jsslog/outputs/commonsLoggingDiagOutput.log
      -Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.Jdk14Logger
      -Djava.util.logging.config.file=C:/jsslog/config/logging-config.properties

      - log4j.configuration specifies to use the dedicated file for loading Log4J configuration. 
      org.apache.commons.logging.diagnostics.dest  specifies the output file for logging diagnostic messages of the Apache Commons Logging 
      org.apache.commons.logging.Log specifies which Log implementation to use, in our case the one that wraps the standard JDK logging mechanisms 
      java.util.logging.config.file specifies to use the dedicated file for loading the Java Logging API configuration 

    3. Create the log4j-config.properties as follow:

      log4j.debug = true
      log4j.appender.fileout = org.apache.log4j.RollingFileAppender
      log4j.appender.fileout.File = C:/jsslog/outputs/studioLOG4J.log
      log4j.appender.fileout.MaxBackupIndex = 5
      log4j.appender.fileout.MaxFileSize = 8192KB
      log4j.appender.fileout.layout = org.apache.log4j.PatternLayout
      log4j.appender.fileout.layout.conversionPattern = %d{ABSOLUTE} %5p %c{1},%t:%L - %m%n
      log4j.rootLogger = DEBUG, fileout

       

    4. Create the logging-config.properties

      # File Handler
      handlers = java.util.logging.FileHandler
      # Set the default logging level for the root logger
      .level = INFO
      # log level for the connectors
      com.jaspersoft.connectors.cassandra.level = ALL
      com.jaspersoft.connectors.hive.level = ALL
      com.jaspersoft.mongodb.level = ALL
      # Default formatter
      java.util.logging.FileHandler.formatter = java.util.logging.SimpleFormatter
      # Specify the location and name of the log file
      java.util.logging.FileHandler.pattern = C:/jsslog/outputs/studio-common.log

    Additional notes

    • As for some other use case scenarios it can be useful to startup Jaspersoft Studio via command prompt in order to further investigate what is happening. For this reason you should locate the JSS installation folder and rename the existing "eclipsec.exe" file to "Jaspersoft Studio (Professional)c.exe".

      Then you can start the JSS application using the command "Jaspersoft Studio (Professional)c.exe" -consoleLog. 

    • Verify that you have permissions to read/write in the folder specified for config/output files. 
    • We did not use the Log4JLogger implementation in the org.apache.commons.logging.Log property because we verified issues similar to those described in here, with a similar error:

       The log adapter 'org.apache.commons.logging.impl.Log4JLogger' is missing dependencies when loaded via classloader <....>

      We need to further investigate the problem. 

    Related articles


    User Feedback

    Recommended Comments

    There are no comments to display.



    Guest
    This is now closed for further comments

×
×
  • Create New...