Change jena-fuseki logging level - java

There's quite little information on jena-fuseki logging on apache documentation, found just this: https://jena.apache.org/documentation/fuseki2/fuseki-logging.html
My jena-fuseki in running in rkt-container, started by command
./fuseki-server ...
I need to change the logging level from INFO to at least WARN or perhaps ERROR.
I tried on test server (i.e. outside of rkt-container) by changing all occurrences of "INFO" to "WARN" 1st in file <directory of fuseki-server>/webapp/log4j2.properties and then in file <directory of fuseki-server>/log4j2.properties without help.
So, how should I change the logging level ?

Related

JMeter can't read custom search_paths directory

I want JMeter to find a jar in lib/ext/custom.
In my jmeter.properties:
search_paths=lib/ext/custom
When I run the test, I get this output:
2019-06-25 10:21:54,792 INFO o.a.j.JMeter: search_paths=lib/ext/custom
2019-06-25 10:21:54,792 WARN o.a.j.JMeter: Can't read lib/ext/custom
Does anyone have an idea why it wouldn't be able to read that directory? It has the same owner as all the other directories/files and has the same permissions as lib/ext itself.
I turned the root longer to DEBUG but received no extra information than the above log messages.
The answer was simple. It could not read the directory because it could not find it because the value I provided it wasn't correct.
search_paths=../lib/ext/custom
It needed that look back to correctly find it. Putting the full path also worked.

Weird output in catalina.out Tomcat9

I'm using Tomcat9 as a server and I'm using Catalina.out as my logger output "System.out" and "System.error" . I don't know every time I open and refresh the Catalina.out file, it gives out the weird output (as shown in picture below) and this output is keep increasing until more than million length. It makes slow loading to open the Catalina.out file. After this weird thing loaded, the logger output that I needed will be at the bottom of those things.
Opened Catalina.out via notepad++ will have below output :
I expect the output doesn't give this weird annoying output.
Guess you need some formatting here. Just follow these steps.
Open your file in Notepad++
Type Control-A (select all)
Type Control-H (replace) In 'Find What' type '\x00'
In 'Replace With' leave BLANK In 'Search Mode' Selected 'Extended'
Then Click on 'Replace All'
I think, the encoding of the log is wrong.
May be, you should check the property of the log writing of Apache Tomcat.
(see http://tomcat.apache.org/tomcat-9.0-doc/logging.html)
Hope, it should help you.
I just found out that weird output will only happens when I delete all the Startup logger in Catalina.out.
Example of Startup logger :
.
.
{some logger}
08-Aug-2019 15:15:22.692 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in [33,192] milliseconds
If I just leave it, it will not give the weird output again.
So, I will close this issue.

How to enable/setup log4j for oozi java workflows?

I'm running an Oozie Java workflow (the jar file is in HDFS), and I'd like to add logging functionality to my application. Does anybody know how to do it? Where should I put my "log4j.properties" file? How can I make log4j to output the log to a location in HDFS?
Looking in this documentation, you can try adding oozie-log4j.properties in your oozie directory (where workflow.xml is).
Here are the default settings:
log4j.appender.oozie=org.apache.log4j.rolling.RollingFileAppender
log4j.appender.oozie.RollingPolicy=org.apache.oozie.util.OozieRollingPolicy
log4j.appender.oozie.File=${oozie.log.dir}/oozie.log
log4j.appender.oozie.Append=true
log4j.appender.oozie.layout=org.apache.log4j.PatternLayout
log4j.appender.oozie.layout.ConversionPattern=%d{ISO8601} %5p %c{1}:%L - %m%n
log4j.appender.oozie.RollingPolicy.FileNamePattern=${log4j.appender.oozie.File}-%d{yyyy-MM-dd-HH}
log4j.appender.oozie.RollingPolicy.MaxHistory=720
It also outlines the following restrictions:
In order for Oozie logging to work 100% correctly, the following restrictions must be observed (described below and in the oozie-log4j.properties file):
The appender that Oozie uses must be named "oozie" (i.e. log4j.appender.oozie )
log4j.appender.oozie.RollingPolicy.FileNamePattern must end with "-%d{yyyy-MM-dd-HH}.gz" or "-%d{yyyy-MM-dd-HH}". If it ends with ".gz" the old logs will be compressed when rolled
log4j.appender.oozie.RollingPolicy.FileNamePattern must start with the value of log4j.appender.oozie.File

Application specific log in tomcat 7 using JULI?

I'm using java system logging in tomcat 7, but no logging statements get written to the log. I've added this file to my WEB-INF/classes. The log file "new-xyz-test" gets created (so I have at least some of the config right) but its empty - no log statements get printed to it.
handlers=java.util.logging.ConsoleHandler, org.apache.juli.FileHandler
org.apache.juli.FileHandler.level=ALL
org.apache.juli.FileHandler.directory=${catalina.base}/logs
org.apache.juli.FileHandler.prefix=new-xyz-test-
java.util.logging.ConsoleHandler.level=ALL
java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter
com.xyz.level=ALL
com.xyz.handlers=org.apache.juli.FileHandler
To configure JULI in the web applications you need have a logging.properties file in the WEB-INF/classes directory. If you use the default handlers, you may lose messages. You need to specify a prefix for the handler in your file.
handlers=1FILE.org.apache.juli.FileHandler, java.util.logging.ConsoleHandler
.handlers=java.util.logging.ConsoleHandler
1FILE.org.apache.juli.FileHandler.level=FINEST
1FILE.org.apache.juli.FileHandler.directory=/app-logs
1FILE.org.apache.juli.FileHandler.prefix=file-1
java.util.logging.ConsoleHandler.level=FINE
java.util.logging.ConsoleHandler.formatter=java.util.logging.SimpleFormatter
com.xyz.level=INFO
com.xyz.handlers=1FILE.org.apache.juli.FileHandler
com.abc.level=INFO
com.abc.handlers=java.util.logging.ConsoleHandler
A
handler prefix (e.g. 1FILE.) starts with a number, then has an arbitrary string, and ends with a period (.).
See more in Logging in Tomcat
Arguments in the JVM
If you are not running the Tomcat from the startup.sh or startup.bat, you need to specify:
The location of the general logging.properties for Tomcat (in the conf directory of Tomcat)
The manager org.apache.juli.ClassLoaderLogManager. This is important because allows you to configure
for each web application different loggin options. By default, a JVM process can only have a single configuration file.) ,
Similar to the next (I'm using eclipse):
-Djava.util.logging.config.file="C:\Users\Paul\workspaces\utils\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\conf\logging.properties" -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
By default, java.util.logging read the file that is included in the JDK or JRE, e.g.:
"C:\Software\jdk1.7.0_17\jre\lib\logging.properties"
Setting Tomcat Heap Size (JVM Heap) in Eclipse, for how to add arguments in the VM
are you sure that you write to the correct logger , i.e. Logger.getLogger("com.xyz")?
I think that you may got wrong when you wrote in logging.properties:com.xyz.level=ALL com.xyz.handlers=org.apache.juli.FileHandler in the case that you actually write to the logger Logger.getLogger(com.xyz.YourClass.class), that because in the logging properties file you should write the logger name which is in your case com.xyz.YourClass

how to setup log4j to specific file for each error / warning/ info (in grails)

I am little bit confuse about log4j in grails.
I need to log info into info.log, error into error.log and warning into warning.log
if possible, all the files (info,warning and error) should be placed into web-app/
so that i can do check via internet (vpn)
can someone help me to do that ?
Assuming you are using Grails 1.1+, what about:
appenders {
file name:'infoLog', file:'info.log', threshold: org.apache.log4j.Level.INFO
file name:'warnLog', file:'warn.log', threshold: org.apache.log4j.Level.WARN
file name:'errorLog', file:'error.log', threshold: org.apache.log4j.Level.ERROR
}
root {
info 'infoLog','warnLog','errorLog'
}
With this configuration, info.log will contain all log messages with level INFO and above (ie. INFO, WARN, ERROR, FATAL), warn.log will contain WARN and above, error.log will contain ERROR and above.
In the example above, I have configured the root logger, so everything (including Grails core) gets logged. But of course, you can configure this more fine-grained if you want.
Hope this helps.

Categories