logging - Translate Basic Config.groovy log4j DSL to external log4j.properties -


The following is a basic log4j configuration inside Config.groovy using log4j DSL with Grails 1.2, as it is expected Works (log errors: 'grails.app' root {error} Errors in the given file:

  log4j = {appenders {file name: 'file', file: " C: /error.log "file '}} How will this be translated into a property style log4j configuration file? The following does not work:  
  Log4j.rootLogger = ERROR, fa log4j.appender.FA = org.apache.log4j.FileAppender log4j.appender.FA.File = C: /error.log Log4j.logger.grails.app = ERROR, FA  

I suspect that there will be an error in 'translation of grails.app' There is something along, but I do not really know, besides, the file can not be created, while with the first DSL version, it starts when the application starts.

If it does make any difference The property file is configured externally (though, the external log4j.groovy file works fine):

  grails.config.locations = ["file: $ {baseir} / Ext Conf / log4j.properties "]  

All I really want is an external log4j property file that logs all application exceptions to a file.

I believe the problem here is that to configure log4j, your property file Adding it is not being used through grails.config.locations will not just work.

An option is to keep log4j.properties on the classpath, for example 'Grails-app / conf in' directly. Check that it works, get the right to the configuration, and then locate the Lodge 4j documentation to find out how you can specify an alternate location for the property file. This may include setting up a system property.


Comments

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -