Unable to automatically update log4j configuration with the External Configuration Reload Plugin - grails

I recently added the External Configuration Reload Plugin to my Grails 2.3.11 project which is using standard log4j logging. I then tried adding the following snippet to my external config.groovy file:
log4j = {
debug 'grails.app'
}
At this point, I saw the below INFO Log Message:
java 2016-09-13 17:31:02,202 [Timer-0] INFO reloadconfig.ReloadConfigService -
Detected changed configuration in preprod-Config.groovy, reloading configuration
However, I did not start receiving DEBUG log messages at this time. When I restarted the application, DEBUG log messages started coming.
I also tried adding this list to my (internal) config.groovy and restarting, but it did not resolve the problem:
grails.plugins.reloadConfig.notifyPlugins = ["LoggingGrailsPlugin", "Log4j", "log4j"]

Related

migration from log4j1.x to log4j2

we are trying to migrate log4j version 1.x to 2.x because of log4j vulnerability. but after migration logs are not getting printed as previous. we have on file in which all console logs (system out) get printed and we have another file which uses TimedRollingFileAppender through java code to write to a file (this appender is in java note in log4j2 xml). but with log4j2 all logger logs coming into console file as well, which is supposed to write only system out logs. when we remove log4j2.xml file all logs comes in debug mode in both the files and when we provide log4j2.xml all logs come in Error mode in both files. we are blocked, anyone can please help here.

Separate logging for rails application in tomcat

We have three apps running in tomcat at different context path. I am using the default context settings in context.xml. We would like one one of the applications that logs to STDOUT to be able to log to its own file.
It is a ruby on rails application that creates the logger as below. It is built as war using jruby file and deployed to tomcat.
if ENV["LOG_STDOUT"].present?
logger = ActiveSupport::Logger.new(STDOUT)
logger.formatter = config.log_formatter
config.logger = ActiveSupport::TaggedLogging.new(logger)
end
We would like to redirect the output from the app to go to it's own file. At the moment, all output from the rails application goes to localhost.date.txt file. Other apps also log to the same file. For instance, a grails app logs unhandled exceptions to the same file.
Questions:
What is the easiest way to redirect the log output to STDOUT from an app at context path /rails/search it's own file without changing the application code?
I have tried with log4j.jar being copied to the appropriate folders if they exist or create the folders and copy of they dont as per the docmentation on tomcat website without much luck.
How can I stop the app at context /grails/hello to stop logging to the localhost.date.txt file.
I have disabled root logging to STDOUT in grails app log4j config, but it still logs unhandled exceptions. In its log file I have restricted the stacktrace to 5 lines, but in localhost.date.txt file it still prints the full stacktrace. I can disable all logging to consoleHandler, but I cannot do it unless I solve the first question. So any help is appreciated.
Things Tried:
Use log4j and slf4j to redirect logs to their own file using swallowOutput on context
Create new tomcat9 handler, but could'nt marry it to the logging class for rails app
Added properties files at appName/WEB_INF/classes/logging.properties and the file is created but no output is logged to the file.

Grails 3.3.1 console giving 404

I have a grails application using the angular profile with the console installed in my build.gradle
console "org.grails:grails-console"
and I am running the application in development mode:
Grails application running at http://localhost:8080 in environment: development
When going to the http://localhost:8080/console and http://localhost:8080/static/console, the console doesn't show. Using the
Chrome console, I see that a 404 error happens:
Request URL:http://localhost:8080/static/console
Request Method:GET
Status Code:404
Remote Address:[::1]:8080
Referrer Policy:no-referrer-when-downgrade
I have no custom interceptors that could interfere with the console and don't use spring security or another security framework.
How can I make the Grails console work on my project?
To use web based console you need to add plugin:
compile 'org.grails.plugins:grails-console:2.1.1'
grails-console GitHub sources and docs
Your dependency:
console "org.grails:grails-console"
is for Swing based console that will run after "grails console" command

Is there any log to find why Struts2 application is giving HTTP 404 error

I am migrating my web application from struts1 to strust2 (struts-core-2.3.16.3) on Tomcat server in Eclipse IDE.I have followed the Apache struts2 documention for migration.My directoey structure looks fine and whatever jars are required for struts2 has been included while removing the strust1 jars. When i run my application,the webapp is getting loaded but it gives http error 404 for the first filter defined in web.xml.
I was trying to find any error logs but could not see any log apart from tomcat access log.
Is there any way to see what is happening with my filters and filter mappings in web.xml through some logs?

Logging configuration completely ignored in Config.groovy when deployed as a war?

When I run my application with run-app, logging seems to work correctly. When I deploy as a WAR in tomcat, all my logging configuration is ignored, and I only see
LOGLEVEL logmessage
Example:
INFO Hello world
What could possibly be causing this? I tried deleting tomcat's logging.properties, but that didn't seem to do anything.
Even after wiping the logging entirely, I still see this in catalina.out, while my logs to a log file are written correctly. A plugin or library, likely, is screwing up my logging, but tracing it down at this point isn't worth it.

Resources