How can I disable freemark logs in struts2 project?
I constantly get enter image description heretons of useless logs like this:
DEBUG 15729 [freemark] (): *************************
I'm using struts 2.5.2 and standard java logging and sysout in code(I'm not using log4j).
In my project I don't have any logging.properties file or struts.properties file.
Under project in Lib folder I am using following jars -
commons-beanutils-1.9.3.jar
commons-collections-3.2.2.jar
commons-digester-2.1.jar
commons-fileupload-1.4.jar
commons-io-2.6.jar
commons-lang-2.4.jar
commons-lang3-3.8.1.jar
commons-logging-1.2.jar
freemarker-2.3.28.jar
javassist-3.20.0-GA.jar
log4j-api-2.8.2jar
ognl-3.1.21.jar
struts2-core-2.5.20.jar
struts2-tiles-plugin-2.5.20.jar
As mentioned in the below link solution Disable Struts2 logs
I have tried to include the log4j.properties inside src folder with the same content. But still I am getting those logs.
Related
I have developed a SpringBoot 2.1.3 WebApp with Thymeleaf 3. For quick testing purpose I create a fat jar with two SQL Procedure which automatically create the DB if it is not present and fill typological table if they are empty.
Now I put my .jar in a CentOS server and launch it by the command:
java -jar mywebapp.jar
All works perfectly but I find a bug in a form submit and I would like to examine the server (embedded) logs.
Which logging level I have to use in the below configuration inside the application.properties:
logging.level.org.apache.tomcat=?
logging.level.org.apache.catalina=?
And where I can find the log text file inside a Unix machine?
Thank you
First of all with embedded tomcat you have to enable log by adding to you application.properties
server.tomcat.accesslog.enabled=true
to specify base directory if you want to save log other then temp folder , also folder that will contain logs
server.tomcat.basedir=tomcat
server.tomcat.accesslog.directory=logs
you can also specify suffix and prefix for logs file
server.tomcat.accesslog.suffix=.log
server.tomcat.accesslog.prefix=access_log
for more properties see here list of common properties , search for tomcat and logging
Also adding logging level as mentioned by the PO in the comment add
logging.level.org.apache.tomcat=ALL
I'm using log4j from the netbeans ide correctly. Now that I'm testing logging from the installed application, anything works.
In the project I have a wrapper module WrapperLog4j (com.aws.log4j) where I put in the log4j wrapped jar file, and the log4j.xml config file in com.aws.log4j package.
In addition, I have an app.conf file to define jdkhome, jvm option, userdir, etc....
The default_userdir="${HOME}/AwsSuite" has setted right, and has the
C:\Users\myuser\AppData\Roaming\AwsSuite value when I execute the installed application.
In the log4j.xml, for the file appender has the value:
All this is working fine when I execute the application from the IDE. In the ProjectFolder/build/testuserdir/var/log is the file awssuite.log required for logging.
I try to changing ${netbeans.user} for ${user.home}, defining new jvm variable in -J-DMyVariable=${HOME}/AwsSuite for use it in log4j.xml as ${MyVariable} in the appender file parameter, but nothing.
Any suggestions?
Any help is appreciated.
I have been trying to debug JSP files (with awful lots of Java code) using the following configuration:
<wls:jsp-descriptor>
<wls:keepgenerated>true</wls:keepgenerated>
<wls:precompile>false</wls:precompile>
<wls:debug>true</wls:debug>
<wls:verbose>true</wls:verbose>
<wls:print-nulls>false</wls:print-nulls>
</wls:jsp-descriptor>
But every time I set a breakpoint in the file I am unable to see the source of the JSP.
I am using Spring Toolsuite and Weblogic 11gR1 (10.3.6). Other than the same configuration for other applications, this is a brand new installation of both.
How can I configure Eclipse to search for the JSP files to debug?
You can precompile the complete war file with: weblogic.appc
or only JSPs with: weblogic.jspc
more details at:
http://devwebcl.blogspot.cl/2014/09/wls-precompile-earwar-ejbjsp.html
java weblogic.jspc -forceGeneration -keepgenerated -verboseJspc -d d:\tmp\export\ -classpath .;D:\proj\webapp-wl-v4\web\WEB-INF\classes;D:\proj\webapp-wl-v4\foo.jar;D:\proj\webapp-wl-v4\lib\bar.jar index.jsp
I am using this doc to change my Tomcat loggers to log4j:
https://tomcat.apache.org/tomcat-7.0-doc/logging.html
my log4j.properties file is as shown in the document, except I changed this line to confirm it's working:
log4j.appender.CATALINA.File = ${catalina.base}/logs/test_catalina
I still see a file logs/catalina.out and not logs/test_catalina, which makes me think either log4j is not being used or my properties file is not read.
I have tomcat-juli-adapters.jar, log4j-1.2.17.jar and log4j.properties in lib
and overwrote bin/tomcat-juli.jar
running set -x catalina.sh start shows:
eval "/a/java64/jdk1.8.0/bin/java" "-Dnop" -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Dlog4j.debug=true -Djava.endorsed.
dirs="/opt/apache-tomcat-7.0.62/endorsed" -classpath "/opt/apache-tomcat-7.0.62/bin/bootstrap.jar:/opt/apache-tomcat-7.0.62/bin/tomcat-juli.jar" -Dcatalina.base="/opt/apache-tomcat-7.0.62" -Dcatalina.home="/opt/apache-tom
cat-7.0.62" -Djava.io.tmpdir="/opt/apache-tomcat-7.0.62/temp" org.apache.catalina.startup.Bootstrap start &
I also have no logging.properties file on disk:
ls conf/*.properties
conf/catalina.properties
I would really appreciate advice on how to debug this -- I'm not sure if a jar is not being found properly, if my log4j.properties has a problem, or Tomcat just plain can't tell I'd like log4j.
Using Tomcat version Server number: 7.0.62.0
I would really appreciate advice on how to debug this
The switch of sending Tomcat log messages from java.util.logging to log4j 1.x is performed by Apache Commons Logging library. (Its compiled package-renamed version is in those tomcat-juli.jar and tomcat-juli-adapters.jar)
There is a debug setting available in Apache Commons Logging. After package renaming the setting name becomes org.apache.juli.logging.diagnostics.dest.
I do not see any evident error in those steps that you performed. Dummy issues may be: are the files readable?
Notes:
It is possible to put tomcat-juli-adapters.jar into $CATALINA_HOME/bin instead of /lib, but you need to update CLASSPATH variable (in your bin/setenv.sh) so that it is included in the value of -classpath argument to java. Repacking the two jars into a single jar file is also an option.
As mentioned by tomcat-7.0-doc/logging.html, deleting conf/logging.properties makes java.util.logging to fallback to default configuration. You may wish to explicitly configure that file.
Source code for tomcat-juli.jar and tomcat-juli-adapters.jar can be found at Maven Central. Those libraries have groupId=org.apache.tomcat.extras
I'm working on a Eclipse RCP application, and I would like to have a customized ConsoleAppender, so I can redirect all logs to the log window.
The log4j plugin and the log4j fragment (containing the log4j.properties) creates a unit which I manage to use successfully.
I've also created an 'extension' plugin containing my code to capture the log-data. Behold the 2 plugins and the fragment below.
rcp_external_log4j (plugin containing the jar file)
log4j-1.2.16.jar
rcp_external_log4j_fragment (containing the log4j.properties file)
log4j.properties (which points to VirtualConsol)
rcp_external_log4j_extension (plugin containing the VirtualConsol)
src/VirtualControl.java (which extends ConsoleAppender)
When I execute my project from within the Eclipse debug environment everything works fine. The VirtualConsole forwards all logging data as expected.
However, when I try to export the project with the 'Eclipse product export wizard' to a standalone executable I get the following problem:
Problem Occured
'Export Product' has encountered a problem.
A cycle was detected when generating the classpath
rcp_external_log4j_extension
rcp_external_log4j
rcp_external_log4j_extension
The VirtualConsole extends ConsoleAppender and is also called from other parts of the code.
The VirtualConsole is located in rcp_external_log4j_extension and uses log4j due to the extending of ConsoleAppender.
The rcp_external_log4j uses the rcp_external_log4j_extension, due to that the rcp_external_log4j plugin is bundled with the rcp_external_log4j_fragment, which refers to the VirtualConsole in the log4j.properties file.
Question: How can I write my own ConsoleAppender without getting a circular dependency? Can I put the code in the fragment? Can I put the code in the plugin containing the jar file (rcp_external_log4j)? I've tried those 2 attempts but without success...
Grateful for any help
Problem solved. src is put in the same plugin as the jar file.
rcp_external_log4j (plugin containing the jar file)
log4j-1.2.16.jar
src/VirtualControl.java (which extends ConsoleAppender)
rcp_external_log4j_fragment (containing the log4j.properties file)
log4j.properties (which points to VirtualConsol)
and 'src' added to the classpath of rcp_external_log4j. Seen in the MANIFEST.MF as
Bundle-ClassPath: log4j-1.2.16.jar,
src/
This way the VirtualConsole may be used both from the fragment and from the other code.
And the build.properties should contain:
jars.compile.order = src/
source.src/ = src/
output.src/ = bin/
for the code to be included in the exported product.
I don't think rcp_external_log4j_fragment needs to have rcp_external_log4j_extension in its build path, only in the manifest. This should remove the cycle.