Disable logging for struts2 validation - validation

I want to disable logging for struts2 validation,whenever a struts action called containing validation I get 'junk' in my log, smth like this :
"[Apr 15 14:42:41] ERROR (CommonsLogger.java:24) - Validation error for domain:blahblah.".
I'm already using log4j and it's logging just fine but I don't want to this 'junk' filling my log.
If some code is nedded I will get it but at this moment I don't know what to present.
To be precise this 'junk' logs are logging the validation messages in struts2 (e.g 'Please enter your name'),maybe this will help someone help me. :)

In log4j you can modify the logging level per-class, and typically every class has its own logger. But they're hierarchical, so you can typically set the logging level for a package and affect all its members. So add the following to your log4j.properties file:
log4j.logger.com.opensymphony.xwork2.validator = FATAL
This is a pretty broad brush though -- with this you won't get visibility into potentially serious problems with validation. You may want to pinpoint which class is emitting the logging message and only modify its logging.

#milostrivun
log4j.logger.com.opensymphony.xwork2.validator = FATAL
This would set the logger level to FATAL which is equivalent to instructing log4j to log message which are of priority FATAL or more(Though there is no higher level than FATAL).
So, the TRACE, DEBUG, INFO, WARN, ERROR level messages coming from any class within the com.opensymphony.xwork2.validator packagae would not get printed.
Makes sense?

Related

How can I configure Quarkus logging to TRACE only my "my.package" category?

How can I configure Quarkus logging to get only trace/debug messages from a desired category?
Here is the properties that I tried so far:
-Dquarkus.log.level=TRACE
-Dquarkus.log.file.enable=true
-Dquarkus.log.file.path=/tmp/trace.log
-Dquarkus.log.file.level=TRACE
-Dquarkus.log.category."my.package".level=TRACE
This will print all trace messages plus my category.
If I remove -Dquarkus.log.level=TRACE no trace/debug messages are printed at all.
Ideas on how to configure it?
What you need to understand is that Quarkus uses various miminum logging levels.
There is a minimum logging level for the what get's logged in the console (quarkus.log.console.level), the minimum logging level for every log category quarkus.log.level and then if you setup a logging level for a category, you have that as well.
So if you want TRACE log messages to the console, you will need to set quarkus.log.console.level=TRACE.
If you don't do that, then the default level is INFO meaning that nothing below INFO will be logged even if the category is set.
This setting is completely unrelated to the setting for logging to the file.

How to get more specific debug messages and warnings from Aurelia

After making some coding changes in my project and refreshing the page, I encountered the error below:
This tells me that the file loan.js could not be found. My first thought, then, is to find out what file is trying to make a call to loan.js. When I expand any of those errors to view the stack trace, I see system files like:
system.src.js:xxx
aurelia-loader-default.js:xxx
aurelia-templating.js:xxx
compose.js:xxx
etc
What does not show up is any specific file that would lead me to where my error is. It turns out that in myFile.js
I had forgotten to provide the specific path to loan.js
view-model="loans/loan"
With multiple view models and views where we make references like the above, how are we expected to debug issues like this when the communication is not specific? Is there some debug, logging error options that I am missing? I'm used to compilers at least providing the last place where the file was attempted to be fetched (causing the 404).

How to log errors when Play Evolutions fail?

I am just getting started with Play Evolutions and I find it pretty tough to figure out why they fail and leave the DB in an inconsistent state.
In Dev mode it will display the error in the default HTML page but it does not say which statement failed. This is also problematic since for this particular application I only have REST APIs that return JSON and so an HTML error is not appropriate. I have my own error handler so I will probably end up matching on ExceptionAttachment and pull out the content/script myself and escape that in the JSON error response. However this is only in DEV mode since I would not want this going back to a real user in PROD.
More frustrating is that it doesn't even log the statement when it fails. I can enable logging for my driver but once the failure has occurred it is too late to then go and enable logging.
Is there anyway to get a more specific error in the logs when an evolution fails?

Codeigniter global error override

Is there a way in Codeigniter to override global errors. For instance if an DB error or PHP critical occurs it wont show the error itself but something like 'Our admin guy is fixing the issue' and the error is just logged and emailed.
Codeigniter lets you handle error messages your way, depending on the HTTP status.
Refer to this documentation on error handling
In addition to #Pos5e5s3dFr3ak's answer, you should handle as many errors as you can manually. For example, if you have a database error, your code should acknowledge (or 'catch') it and perhaps load the appropriate view, or pass it onto a library that will log an email the fault, instead of displaying the intended result.
This method can be used as an alternative, or as an addition to the original answer - sometimes you need not locate the error just by its HTTP response Status Code.
As an example, you may find that the database engine in use is down. If this is the case (you would have to determine if it is indeed down - ie. you are not getting the desired response), you would pass the user on to example.com/error/database, for example.

Can sitebricks be configured to not say "Sitebricks received a null reply from the resource..."?

In some error cases including the one above Sitebricks adds a stack trance to the response. This is a security issue with leaking information. We plug the problems we find but is there a way to tell site bricks never to send stack traces?
The problem is not at the Sitebricks level but at your servlet container or Filter level. If you are using a normal servlet container you should configure error pages in web.xml using the directive:
http://www.tutorialspoint.com/servlets/servlets-exception-handling.htm
Alternatively, you can use a filter to check if the response code is not 2XX and display a custom error page yourself.
Sitebricks shows the error trace as a debugging tool.

Resources