I am trying to configure the loggin to my web application.
This is where I want my application to put the logs:
C:\installs\JBossServer\jboss-6-0\server\default\log\kiche
If I do the following in the log4J.properties, the logs are created fine:
log4j.appender.R.File =C:\\installs\\JBossServer\\jboss-6-0\\server\\default\\log\\kiche\\kicheapp.log
I have an environment variable
JOBSS_HOME=C:\installs\JBossServer\jboss-6-0
And when I do like following in the log4J.properties, it not working.
log4j.appender.R.File=${JBOSS_HOME}\\server\\default\\log\\kiche\\kicheapp.log
Can someone please help me, I want to use JBOSS_HOME, so that its not hardcoded.
I am using JBOSS as a webserver.
Any help will be greatly appreciated.
Regards
Adofo
Maybe better is to edit jboss-log4j.xml ?
You should try :
JBOSS_HOME=C:\\installs\\JBossServer\\jboss-6-0
and also :
JBOSS_HOME=C:/installs/JBossServer/jboss-6-0 (change log4j.appender.R.File accordingly with "/" instead of "\\")
Also, is there a typo in your question or in your variable ? (JBOSS_HOME vs JOBSS_HOME)
log4J.properties cannot access the environment variables directly. Instead , you should use java system properties to do the substitution.
Tomcat 's start up script has the option -D<name>[=<value>] to set a system property .Please try to start the tomcat by using run.sh -DJBOSS_HOME=C:\installs\JBossServer\jboss-6-0
Related
I added db2 driver, edited module.xml in JBOSS_HOME/modules/com/ibm/main.
In this folder, I have
db2jcc4.jar
db2jcc_lecense_cu.jar
db2jcc_license_cisuz.jar
module.xml
After having these, I tried to launch JBoss console on Powershell
.\standalone.bat --server-config=standalone-full-ha.xml -Dcom.sun.CORBA.ORBDynamicStubFactoryFactoryClass=com.sun.corba.se.impl.presentation.rmi.StubFactoryFactoryStaticImpl
which I tried to handle ORB exception(related to this https://bugs.openjdk.java.net/browse/JDK-6497156)
But my jboss container is not launched. I checked the log file,
2019-09-17 296 FATAL [org.jboss.as.server] (main) WFLYSRV0239: Aborting with exit code
and error display on Powershell
WFLYSRV0073: Invalid option '.sun.CORBA.ORBDynamicStubFactoryFactoryClass=com.sun.corba.se.impl.presentation.rmi.StubFactoryFactoryStaticImpl'
It works on command prompts though. I am wondering it is correct way to pass argument like this. Thanks in advance!
Edit
I am using Java8, JBoss7.1
Powershell has issues with -D. Try this instead, notice the " around -D
.\standalone.bat --server-config=standalone-full-ha.xml "-Dcom.sun.CORBA.ORBDynamicStubFactoryFactoryClass=com.sun.corba.se.impl.presentation.rmi.StubFactoryFactoryStaticImpl"
I have the following property in my application.properties.
spring.profiles.active=dev,local
This works fine. However, I decided to also expose this as an environment variable and keep dev,local as the default values. However the following does not work.
spring.profiles.active=${PROFILES_ACTIVE:dev,local}
It seems comma causes this issue.
Checking the logs
[2018-05-24 05:38:28.163] [main] [INFO] [Application] The following profiles are active: ${PROFILES_ACTIVE:dev,local}
However, the following works.
spring.profiles.active=${PROFILES_ACTIVE:dev}
Any suggestions on how go about this?
Try:
spring.profiles.active=${PROFILES_ACTIVE:#{'dev,local'}}
It uses the EL syntax with templating.
I want to write logging-messages to a defined file into the tomcat's log-folder, using eclipse, maven, tinylog.
Problem: There is no webapp.log as soon as I run the app in tomcat.
In eclipse everything works fine.
What I did:
add Maven-dependency tinylog-1.2.jar
set configuration-parameter in Run Configuration (Main-Tab) so the tinylog-properties can be found for the build-process:
name: -Dtinylog.configuration
value: C:\Program
Files\Tomcat\apache-tomcat-9.0.0.M13\webapps\folder\subfolder\tinylog.properties
in Java-Class:
import org.pmw.tinylog.Logger;
...
Logger.info(message);
tinylog.properties looks like:
tinylog.writer = file
tinylog.writer.filename = webapp.log
tinylog.writer.buffered = true
tinylog.writer.append = true
tinylog.level = info
I also tried different file-references but none of them worked:
tinylog.writer.file = C:\Program Files\Tomcat\apache-tomcat-9.0.0.M13\logs\webapp.log
tinylog.writer.file= "C:\Program Files\Tomcat\apache-tomcat-9.0.0.M13\logs\webapp.log"
Does anybody know how to write the logs into the named path-file?
Thanks for any valuable hint.
I propose to use the tinylog-jul artifact instead of the usual tinylog artifact. tinylog-jul provides the tinylog API, but uses the Tomcat logging back end. So, you don't need to configure tinylog. All log entries will be automatically output as you are used to with other logging APIs on Tomcat.
I have downloaded commom-daemon tool and used with a java application. I have created a bat file as shown below
set SERVICE_NAME=sample
set PR_INSTALL=D:\commons-daemon-1.0.15-bin-windows-signed\prunsrv.exe
REM Service log configuration
set PR_LOGPREFIX=%SERVICE_NAME%
set PR_LOGPATH=D:\logs
set PR_STDOUTPUT=D:\logs\stdout.txt
set PR_STDERROR=D:\logs\stderr.txt
set PR_LOGLEVEL=Error
REM Path to java installation
set PR_JVM=C:\Java\jre7\bin\client\jvm.dll
set PR_CLASSPATH=D:\commons-daemon-1.0.15-bin-windows-signed\Daemon.jar
REM Startup configuration
set PR_STARTUP=auto
set PR_STARTMODE=jvm
set PR_STARTCLASS=com.SomeService
set PR_STARTMETHOD=start
REM Shutdown configuration
set PR_STOPMODE=jvm
set PR_STOPCLASS=com.SomeService
set PR_STOPMETHOD=stop
REM JVM configuration
set PR_JVMMS=256
set PR_JVMMX=1024
set PR_JVMSS=4000
set PR_JVMOPTIONS=-Duser.language=DE;-Duser.region=de
In cmd , I install the service using the command
prunsrv.exe //IS//sample
After this, a service named sample become available in the list of services and when I tried to start it it shows:
Windows could not start the sample on Local Computer. For more information review the System event log. If this is a non-Microsoft service, contact the service vendor and refer to the server specific
error code 1
UPDATED
When I run
prunsrv.exe //ES//sample
it shows
The data area passed to a system call is too small.
Failed to start service
Can any one help me in this?
I had the same problem. In my case (not yours exactly), the problem was the jvm.dll path, because the variable %JAVA_HOME% has spaces. So to solve this, I modify the assignment
set CG_PATH_TO_JVM=%JAVA_HOME%\jre\bin\server\jvm.dll
to
set CG_PATH_TO_JVM="%JAVA_HOME%\jre\bin\server\jvm.dll"
and that's all.
Also, you could check the variables assignment with this command:
prunmgr//ES//yourservicename_as_in_windows
To help others troubleshooting.
If you look at:
https://commons.apache.org/proper/commons-daemon/procrun.html
There is a parameter:
--LogPath
which defaults to:
%SystemRoot%\System32\LogFiles\Apache
A log file is generated there which contains some additional error messages and possibly useful information.
The original questioner changed the log path to:
set PR_LOGPATH=D:\logs
So looking there would be the appropriate thing to do in their case.
I also had this cryptic error message 'The data area passed to a system call is too small.' with no further information in either the startup log or the Windows/System32/LogFiles/Apache/ logs on Win 8/Server 2008.
I had renamed my packages and the --StartClass and --StopClass parameters were wrong.
I agreed with OscarSan that a space in %JAVA_HOME% could cause the "error code 1" problem. I solve this problem by re-installing JDK 1.8 to change the installation path from C:\Program Files Java\jdk1.8.0_144 to C:\Java\jdk1.8.0_144. Problem solved.
I have a project in IntelliJ IDEA I want to run locally. When I click its debug button it says:
ERROR: Cannot load this JVM TI agent twice, check your java command line for duplicate jdwp options.
Disconnected from server
Error occurred during initialization of VM
agent library failed to init: jdwp
When I click the run button it works. What is the matter?
This is probably too late to help you, but maybe it will help somebody else. The answer is based on a support forum posting by Aleksei Sosnovski.
This can happen when your JAVA_OPTS contains two -Xrunjdwp arguments. E.g., one of these arguments might come from the server start script invoked by IntelliJ to start the container, and another may be added by IntelliJ itself. You can check by looking at JAVA_OPTS in the log when launching the container without debug. If you see an -Xrunjdwp argument, just find where it is set in the container startup script, and remove it.
I guess you already are debugging the server app? In this case it's not possible to connect another instance of debugger.
Most likely the problem happens because you have specified the debugging options in the "VM parameters" field of your run configuration. Everything will work if you remove them.
I had the same problem in my case -Xrunjdwp was set twice: one in the IDEA debug configuration and again in the system variables in CATAALINA_OPTS.
once I removed it from system variables (inside the IDEA it is read only) problem was fixed
Thanks for the tips, it helped me work out the problem too. Mine was due to having
set DEBUG_OPTS=-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005
In my catalina.bat
check server.xml if you have jvmEntries get rid of that entry from server.xml
<!-- <jvmEntries xmi:id="JavaVirtualMachine_1" classpath="" bootClasspath="" verboseModeClass="false" verboseModeGarbageCollection="false" verboseModeJNI="false" runHProf="false" hprofArguments="" debugMode="false" debugArgs="-Djava.compiler=NONE -Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=7777" genericJvmArguments="">
Open admin console (http://localhost:9060/ibm/console/login.do)
Application servers > server1 > Debugging service
un-check Enable service at server startup if checked restart server.
On Intellij uncheck the 'Pass environment variables' box in Run/Debug configuration