How to use server.xml with embedded Tomcat 9?

2018-12-17 Thread Ryan Palmer
Hello,

I'm using the Tomcat class to embed the container in my application. I have 
configured the CATLINA_HOME and _BASE properties, and I know those are working 
because the 'work' folder gets generated there as expected. However if I put a 
server.xml file in a 'conf' folder in the same directory, it does not seem to 
be loaded when calling Tomcat.init().

Documentation is very sparse on the Tomcat class so I am unsure how to 
configure it the "standard" way.

Thank you,
Ryan Palmer


Re: log4j app logging

2018-12-18 Thread Ryan Palmer
Michael,

The file needs to be named log4j.properties (or .xml, 
.json, etc.) and needs to be in the classpath. You ommitted the 'j'.

Sent from BlueMail
On Dec 18, 2018, at 9:42 AM, "Lemke, Michael ST/HZA-ZIC2" 
mailto:lemke...@schaeffler.com>> wrote:

I have an old webapp that uses log4j 1.2 and which I am trying to deploy on 
tomcat. For the heck of it I can't get tomcat to use the 
log4.properties file. What am I doing wrong?

tomcat 9.0.6 is installed as a Windows service and does serve my webapp, so the 
app is working fine. The project is mavenized, I put 
log4.properties to src/main/resources and it ends up in 
the jar file of my application. Is there anything special that needs to be done?



To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: log4j app logging

2018-12-18 Thread Ryan Palmer
Michael,

Tomcat uses JULI internally. Have you taken necessary steps to redirect JULI to 
log4j?

Thanks,
Ryan


From: Lemke, Michael ST/HZA-ZIC2 
Sent: Tuesday, December 18, 2018 10:20 AM
To: Tomcat Users List
Subject: RE: log4j app logging

On December 18, 2018 6:59 PM
Ryan Palmer wrote:
>
>The file needs to be named log4j.properties<http://log4j.properties> (or .xml, 
>.json, etc.) and needs to be in the classpath. You ommitted the 'j'.

Thanks for spotting this. Unfortunately, this typo was only in the email:

pc# ls src/main/resources/
com  log4j.properties


So for being in the classpath it is sufficient to have it packaged in the jar, 
isn't it?

Archive:  myapp-1.1.0-SNAPSHOT.jar
 Length   MethodSize  CmprDateTime   CRC-32   Name
  --  ---  -- -   
   0  Stored0   0% 12-18-2018 16:56   META-INF/
  98  Defl:N   91   7% 12-18-2018 16:56 48730e36  META-INF/MANIFEST.MF
   0  Stored0   0% 12-18-2018 16:56   META-INF/maven/
...
   0  Stored0   0% 12-18-2018 16:56   com/
...
1123  Defl:N  451  60% 12-18-2018 16:56 eea5d81a  log4j.properties

It ought to be something simple but before further digging into my setup 
details I want to make sure there isn't something special for tomcat. Something 
in ${catalina.base}/conf or conflicts with tomcat's logging system.


>On Dec 18, 2018, at 9:42 AM, "Lemke, Michael ST/HZA-ZIC2" wrote:
>
>I have an old webapp that uses log4j 1.2 and which I am trying to deploy on 
>tomcat. For the heck of it I can't get tomcat to use the 
>log4.properties<http://log4.properties> file. What am I doing wrong?
>
>tomcat 9.0.6 is installed as a Windows service and does serve my webapp, so 
>the app is working fine. The project is mavenized, I put 
>log4.properties<http://log4.properties> to src/main/resources and it ends up 
>in the jar file of my application. Is there anything special that needs to be 
>done?
>
>
>
>To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
>For additional commands, e-mail: users-h...@tomcat.apache.org
>

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Context specific context.xml not loading.

2018-12-20 Thread Ryan Palmer
Melvin,

Do you have any context.xml for this context in the 
CATALINA_BASE/conf/Catalina/localhost/ directory? It may be overriding your 
META-INF/context.xml

-Ryan
On Dec 19, 2018, at 10:45 PM, Melvin 
mailto:melvind...@gmail.com>> wrote:
Hello All,

Just came across a problem today. Hope someone will clarify it.

Tomcat 9.0.13.
I wanted to customize ErrorReportValve by setting showReport="false" 
showServerInfo="false".

Below is the META-INF/context.xml -




It works fine for any internal server error produced or exceptions thrown. But 
for the case when the browser sends unencoded characters the URL becomes 
invalid and Exception is thrown and stacktrace is shown in the browser.
When I give this valve in server.xml. It works fine. No issues. No stacktrace 
is shown on the browser when sending unencoded characters. When I give it in my 
context it fails only for this case.

Can anyone please help me on this.
Thanks in advance for your help.
Regards,
Melvin A