how can i use log4j in grails application? - grails

how can i use log4j in grails application?

Look at the Logging section of the manual.
log4j is built in and has a basic configuration out of the box.

You could use log4j right from the box, for example:
log.debug "The value of foo is $foo"
Configuration of logging in last version
If you are into unit testing be sure to check mockLogging method in Testing section.

Related

Configure Flogger with log4j2 backend

I try to use flogger with the log4j2 backend. Seems to work fine.
My problem is, how to configure output pattern, output level or appenders in general using log4j files (xml or properties).
If using this constellation without any configuration, only level error is logged.
OK, I missed to add log4j-web package, so everything was fine in a standalone app, but this package is needed in a web application

Appenders while migration from log4j1.2.x to log4j 2

We are working on adding custom level logging into our logger (which is currently log4j 1.2.x) and understood that this functionality is supported since log4j 2.
Thus we are planning to migrate from log4j 1.2.x to log4j2 version. However, our logger application is completely dependent on the log4j 1.2.x appenders where we directly extend / inherit appender classes like FileAppender etc. Right the bridge dont have support for the individual appenders and we are using the appenders in our application to log data.
Is there any way that those classes (which are dependent on FileAppender) can be readily migrated, because I dont see much information in internet / apache.org to get the internals.
Appreciate your help.
Thanks.

Setting Tracing On for apache camel

I want to test my integration test cases, for that i want to set my camel tracing on to debug my test cases.
how to do this in grails any idea? I am using log4j for logging.
From Camel 2.12 onwards you must explicit enable tracing on the CamelContext. The class contains setTracing(Boolean enabled) method.
So if you are using XML DSL:
<camelContext trace="true" ...>
otherwise:
camelContext.setTracing(true)
To setup logging is quite trivial I supposed.

What is the difference between BuildConfig.groovy and Config.groovy?

I have a grails app. Why do some properties work in one but not the other? When do I put properties in one and when do I put them in the other one?
From Grails doc here
The first,
BuildConfig.groovy, is for settings that are used when running Grails
commands, such as compile, doc, etc. The second file, Config.groovy,
is for settings that are used when your application is running. This
means that Config.groovy is packaged with your application, but
BuildConfig.groovy is not.

Consuming a WSDL in Grails

I have been handed a .WSDL file which I need to test within a Grails Framework.
Any suggestions how to go about this.
Take a look at the http://grails.org/plugin/cxf and http://grails.org/plugin/cxf-client plugins. They're easy to use and backed by Apache CXF - https://cxf.apache.org/
The client plugin has a wsdl2java script that will generate code that you can use in your Grails app.
You could start with documentation itself: http://grails.org/Calling+External+WebServices

Resources