Log level in tests for PlayFramwork 1.x - log4j

When I launch my tests in localhost:9000/#tests# in console I can see long-long log with DEBUG log-level. I want to get rid of that. I tried to put to my application.conf
line like:
application.log=INFO
or even this line:
application.log.system.out=off
But it does not work. Maybe I should put log4j setting specially for test context somehow..?

You can simply prefix those two rules with the "test" id.
%test.application.log.system=off
%test.application.log=ERROR
And by the way log levels are : trace -> debug -> info -> warn -> error -> fatal
So when displaying info, you are displaying a lot of information.

What's your log4j.properties configuration? Most likely you have Debug enabled in there.
If you have this setting enabled:
application.log.path=/log4j.properties
try to disable it and run the tests to verify this is changing the logs. If that's the issue then modify that line to:
%test.application.log.path=/log4j-test.properties
%dev.application.log.path=/log4j-dev.properties
and create the 2 versions of log4j.properties, so you have the right logging level in each.

Related

How to change log.info/error message's font color in Jmeter's JSR223?

I'm trying to find a way to change log.info/error message's font color so that it would be easier for me to read messages in Jmeter's JSR223 Log section
any advice ?
thanks,
As per current version (JMeter 4.0) I don't think it is possible. You can use Groovy Coloriser library if you want, however it will only work for println statements, not for JMeter's log.error
The only way you can filter out the log output to errors only is configuring JMeter logging subsystem to display only messages of ERROR level (or above). You can do this in at least 2 ways:
Locate <Root level="info"> line in log4j2.xml file (lives in "bin" folder of your JMeter installation) and change info to error. JMeter restart will be required to pick the property up
Or you can simply run JMeter like jmeter -LERROR
In both cases you will not be seeing all these INFO and/or WARN messages anymore, you will see only ERROR and above.
More information:
Overriding Properties Via The Command Line
How to Configure JMeter Logging

How to suppress logs for ContextHandler in spark

In my log4j file, I have already added the following log level for ContextHandler,
but, ContextHandler stuff still prints the log.
log4j.logger.org.eclipse.jetty.server.handler.ContextHandler=WARN
log4j.logger.org.mortbay.jetty.handler.ContextHandler=WARN
I would ask how to suppress ContextHandler logs.
Adding this to your log4j.properties should help:
log4j.category.org.spark_project.jetty=WARN
Update: Since Spark 3.0 it's changed to
log4j.category.org.sparkproject.jetty=WARN (thanks #ivan-vergiliev)

activemq start suppresses stdout/stderr

when using AMQ 5.6 and starting the broker using ./activemq start...where does the stdout/stderr go?
I expected it to show up in the /data/activemq.log file, but it doesn't...is there are way around this with a tweak to the log4j or JavaServiceWrapper config perhaps?
When I start in console mode using ./activemq console, the stdout/stderr messages are displayed as expected. In particular, I need to get output from e.printStackTrace() to show up in the logs when running in this mode.
it seems to just get redirected to /dev/null...I changed the /bin/activemq script to redirect to ../data/start.log instead and sure enough, the stdout/err are there...not sure why this isn't the default behavior to be honest...
When i remember correctly, there is another file called wrapper.log. look out for it in the same dir where wrapper.conf is.

Puppet: disable echo of notify commands

I would like to print some messages and variable values while my configuration is applied.
I would also like to separate the output of different configuration blocks visually. so I use
notify {"\n\nINSTALL TOMCAT TO $target_folder":}
as described in puppet tutorials and documentation.
Unfortunately the output does not really add readability to the whole log:
notice:
INSTALL TOMCAT TO /opt/example/uiserver
notice: /Stage[main]//Node[dev-xyz.example.com]/Tomcat[uiserver_tomcat]/Notify[
INSTALL TOMCAT TO /opt/example/uiserver]
INSTALL TOMCAT TO /opt/example/uiserver'
Problem - instead of just printing the message, puppet also outputs an annoying echo /message: defined 'message' as '. Is there any way to eliminate it?
Using withpath => false did not help.
Puppet 2.7.17.
Set --logdest to syslog.
It's console by default.
--logdest:
Where to send messages. Choose between syslog, the console, and a log
file. Defaults to sending messages to the console.
Maybe try using the notice() function instead of the notify type as per http://www.puppetcookbook.com/posts/simple-debug-messages.html
With the notice() function mesagee will be written to the puppetmaster's log instead of the client, but there won't be an echo line echo'd back.

Using log4j for different applications

I have a problem with log4j loggin and I hope you can help me on this.
This is the scenario: I have 3 different applications (in other words 3 .jar) A, B and C. A is always running and from time to time calls B and C to execute them. Each of them have its own log4j.properties (with the path duly included in the MANIFEST) but Log4j only takes the properties of the main app A into consideration, ignoring the rest. I need to know if I can force Log4j to use for each app its own properties. I have seen something related using DOMConfigurator, but if I'm not wrong this only works with xml files and I'm using properties.
Thanks in advance
There are several Configurators, one of which is the PropertyConfigurator.
I need to know if I can force Log4j to use for each app its own properties.
Yes, you can. When you launch the applications B and C, define this system variable at their command line:
-Dlog4j.configuration=B.properties
where B.properties is the file name of log4j properties file in B's classpath. Likewise for application C.
Edit: found this: Change location of log4j.properties

Resources