This is actually documented in https://jira.atlassian.com/browse/JRA-8100
Problem: this exceptions is treated as a server error by JIRA and written in the log files and on the console!
Bad user input is not a server error, it is a normal use case...
I would like to know how to handle it best.
Thanks to Jobin suggestion I am satisfied with following solution using configurable version of custom filter:
log4j.appender.console.filter.01=sk.eea.jira.log4j.filters.ValidatorExceptionFilter
log4j.appender.validatorexlog=com.atlassian.jira.logging.MultiTenantJiraHomeAppender log4j.appender.validatorexlog.File=atlassian-jira-validator-exceptions.log log4j.appender.validatorexlog.MaxFileSize=20480KB log4j.appender.validatorexlog.MaxBackupIndex=5 log4j.appender.validatorexlog.layout=org.apache.log4j.PatternLayout log4j.appender.validatorexlog.layout.ConversionPattern=%d %t %p %X{jira.username} %X{jira.request.id} %X{jira.request.assession.id} %X{jira.request.ipa
log4j.appender.validatorexlog.filter.01=sk.eea.jira.log4j.filters.ValidatorExceptionFilter log4j.appender.validatorexlog.filter.01.AcceptOnMatch=true log4j.appender.validatorexlog.filter.99=org.apache.log4j.varia.DenyAllFilter log4j.logger.com.atlassian.jira.workflow.OSWorkflowManager=ERROR, validatorexlog
Jozef: I copied your jar file into the lib directory:
/opt/atlassian/jira/lib/jira-log4j-extras-1.1.jar /opt/atlassian/jira/lib/slf4j-log4j12-1.6.4.jar /opt/atlassian/jira/lib/log4j-1.2.16.jar
And I restarted my 5.2.11 standalone jira server but got the following error in the catalina.out file:
INFO: Starting Servlet Engine: Apache Tomcat/7.0.29 log4j:ERROR Could not instantiate class [sk.eea.jira.log4j.filters.ValidatorExceptionFilter ]. java.lang.ClassNotFoundException: sk.eea.jira.log4j.filters.ValidatorExceptionFilter at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source)
... remaining exception trace deleted for brevity
Note: Append the following text to log4j.properties:
############################################################ log4j.appender.console.filter.01=sk.eea.jira.log4j.filters.ValidatorExceptionFilter
So what did I do wrong?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Are you sure you removed log4j-1.2.15.jar?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes, I used the command: "find /opt/atlassian/jira -name \*log4j\*" to determine that full list of three jar files.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Jozef,
I have one Idea: Maybe it is not possible to use the filter on the default console appender?
The filter itself works on my selfdefined validatorexlog...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes, I've read that article and there is stated, that it works in 1.2.16.
Well, I have checked back to the history of mercurial queue and found we were using it on JIRA 4.4.5 with replaced log4j in lib directory. I have no clue, why it not works for you.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I found an article where is statet that Filters cannot be defined in
http://stackoverflow.com/questions/3730343/log4j-stringtomatch-in-property-file
Strange stuff:
log4j.appender.console.filter.01=sk.eea.jira.log4j.filters.ValidatorExceptionFilter
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I did copy both jars to Folder
/opt/atlassian/jira/lib/ as stated above (there was my old log4j file which I removed).
I also tried to put file here: /opt/atlassian/jira/atlassian-jira/WEB-INF/lib/jira-log4j-extras-1.1.jar
but it did not work - I get an error:
log4j:ERROR Could not instantiate class [sk.eea.jira.log4j.filters.ValidatorExceptionFilter ]. java.lang.ClassNotFoundException: sk.eea.jira.log4j.filters.ValidatorExceptionFilter at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method)
Which shows me having a not loaded classfile.
Do I have to add this anywhere? Normally my Classloader should pick this anytime?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Can I use log4j-1.2.16 in Jira 4.4.4 without any side effects?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This is not an asnwer, anyway you can - replace older version in JIRA instalation
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I see. The only issue with that is what Atlassian suggested in the ticket itself. Sometime the InvalidInputException is not genuine and you might want to log them. Wiping them completely out might hide some errors. But as long as you know your config, that must be okay.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
What are you filtering here? All errors of type InvalidInputException? or all errors?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Actually I came after some investiogation to solution that avoids the ERROR completely. Anyway, it would be nicer, to change the level into INFO and single line.
To filter out the logging event completely, you should
log4j.appender.console.filter.01=sk.eea.jira.log4j.filters.ValidatorExceptionFilter
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yeah, it is a pain but I haven't come across a way to handle it!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.