Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Logback #3442

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from
Draft

Logback #3442

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions core/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,9 @@ LABEL maintainer="Camptocamp <info@camptocamp.com>"

RUN --mount=type=cache,target=/var/cache,sharing=locked \
--mount=type=cache,target=/root/.cache \
perl -0777 -i -pe 's/(<Valve className="org.apache.catalina.valves.AccessLogValve"[^>]*>)/<Valve className="ch.qos.logback.access.tomcat.LogbackValve" quiet="true"\/>/s' "${CATALINA_HOME}/conf/server.xml" \
&& echo "tomcat.util.scan.StandardJarScanFilter.jarsToSkip=*" >> "${CATALINA_HOME}/conf/catalina.properties" \
echo "tomcat.util.scan.StandardJarScanFilter.jarsToSkip=*" >> "${CATALINA_HOME}/conf/catalina.properties" \
&& echo "org.apache.catalina.startup.TldConfig.jarsToSkip=*" >> "${CATALINA_HOME}/conf/catalina.properties" \
&& echo "tomcat.util.scan.DefaultJarScanner.jarsToSkip=*" >> "${CATALINA_HOME}/conf/catalina.properties" \
&& perl -0777 -i -pe 's/<\/Context>/<Resources cachingAllowed="true" cacheMaxSize="102400"\/><\/Context>/' "${CATALINA_HOME}/conf/context.xml" \
&& mkdir --parent /usr/local/tomcat/conf/Catalina /usr/local/tomcat/work/Catalina \
&& chmod -R g+rwx /usr/local/tomcat/conf/Catalina /usr/local/tomcat/work \
&& chgrp -R root /usr/local/tomcat/conf/Catalina /usr/local/tomcat/work \
Expand All @@ -24,7 +22,6 @@ COPY docker /

RUN mkdir -p "${CATALINA_HOME}/extlib/classes/org/mapfish/print" \
&& cp -r "${CATALINA_HOME}/webapps/ROOT/WEB-INF/classes/org/mapfish/print/url" "${CATALINA_HOME}/extlib/classes/org/mapfish/print/" \
&& perl -0777 -i -pe 's/<Valve className="ch.qos.logback.access.tomcat.LogbackValve" quiet="true"\/>//s' "${CATALINA_HOME}/conf/server.xml" \
&& chmod g+r -R /usr/local/tomcat/conf/ \
&& chmod g+rw /usr/local/tomcat/temp/ /usr/local/tomcat/webapps/ROOT/WEB-INF/lib \
&& chmod g+rw /usr/local/tomcat/webapps/ROOT/WEB-INF/classes /usr/local/tomcat/webapps/ROOT/WEB-INF/classes/*.xml \
Expand Down
10 changes: 6 additions & 4 deletions core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ dependencies {
"org.springframework:spring-jdbc:5.3.39",
"org.springframework:spring-tx:5.3.39",
"org.springframework:spring-test:5.3.39",
"javax.media:jai-core:1.1.3"
"javax.media:jai-core:1.1.3",
)
metrics(
"io.dropwizard.metrics:metrics-core:4.2.27",
Expand Down Expand Up @@ -171,13 +171,16 @@ dependencies {
"net.sf.jasperreports:jasperreports-functions:6.21.3",
'joda-time:joda-time:2.12.7'
)
implementation(
"ch.qos.logback:logback-classic:1.5.7",
"ch.qos.logback:logback-access:1.4.14",
'net.logstash.logback:logstash-logback-encoder:8.0',
)
implementation(
'com.google.guava:guava:33.0.0-jre',
"org.slf4j:slf4j-api:2.0.16",
"org.slf4j:jcl-over-slf4j:2.0.16",
"org.slf4j:jul-to-slf4j:2.0.16",
"ch.qos.logback:logback-classic:1.5.7",
"ch.qos.logback:logback-access:1.4.14",
'org.json:json:20240303',
'org.yaml:snakeyaml:2.2',
'com.github.spullara.cli-parser:cli-parser:1.1.6',
Expand All @@ -186,7 +189,6 @@ dependencies {
'com.amazonaws:aws-java-sdk-s3:1.12.770',
'com.adobe.xmp:xmpcore:6.1.11',
'io.sentry:sentry-logback:7.5.0',
'net.logstash.logback:logstash-logback-encoder:8.0',
)

implementation(
Expand Down
1 change: 1 addition & 0 deletions core/docker/usr/local/tomcat/bin/docker-start-print
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,5 @@ fi

mkdir -p print-apps
rm -f /usr/local/tomcat/temp/mapfish-print/ROOT/stop /usr/local/tomcat/temp/mapfish-print/ROOT/stopped
echo "Start Catalina"
exec catalina.sh run
11 changes: 11 additions & 0 deletions core/docker/usr/local/tomcat/conf/context.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- The contents of this file will be loaded for each web application -->
<Context>
<!-- Default set of monitored resources. If one of these changes, the -->
<!-- web application will be reloaded. -->
<WatchedResource>WEB-INF/web.xml</WatchedResource>
<WatchedResource>WEB-INF/tomcat-web.xml</WatchedResource>
<WatchedResource>${catalina.base}/conf/web.xml</WatchedResource>

<Resources cachingAllowed="true" cacheMaxSize="102400"/>
</Context>
95 changes: 95 additions & 0 deletions core/docker/usr/local/tomcat/conf/server.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Note: A "Server" is not itself a "Container", so you may not
define subcomponents such as "Valves" at this level.
Documentation at /docs/config/server.html
-->
<Server port="8005" shutdown="SHUTDOWN">
<Listener className="org.apache.catalina.startup.VersionLoggerListener" />
<!-- Security listener. Documentation at /docs/config/listeners.html
<Listener className="org.apache.catalina.security.SecurityListener" />
-->
<!-- APR connector and OpenSSL support using Tomcat Native -->
<Listener className="org.apache.catalina.core.AprLifecycleListener" />
<!-- OpenSSL support using FFM API from Java 22 -->
<!-- <Listener className="org.apache.catalina.core.OpenSSLLifecycleListener" /> -->
<!-- Prevent memory leaks due to use of particular java/javax APIs-->
<Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" />
<Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
<Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" />

<!-- Global JNDI resources
Documentation at /docs/jndi-resources-howto.html
-->
<GlobalNamingResources>
<!-- Editable user database that can also be used by
UserDatabaseRealm to authenticate users
-->
<Resource name="UserDatabase" auth="Container"
type="org.apache.catalina.UserDatabase"
description="User database that can be updated and saved"
factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
pathname="conf/tomcat-users.xml" />
</GlobalNamingResources>

<!-- A "Service" is a collection of one or more "Connectors" that share
a single "Container" Note: A "Service" is not itself a "Container",
so you may not define subcomponents such as "Valves" at this level.
Documentation at /docs/config/service.html
-->
<Service name="Catalina">

<!--The connectors can use a shared executor, you can define one or more named thread pools-->
<!--
<Executor name="tomcatThreadPool" namePrefix="catalina-exec-"
maxThreads="150" minSpareThreads="4"/>
-->


<!-- A "Connector" represents an endpoint by which requests are received
and responses are returned. Documentation at :
Java HTTP Connector: /docs/config/http.html
Java AJP Connector: /docs/config/ajp.html
APR (HTTP/AJP) Connector: /docs/apr.html
Define a non-SSL/TLS HTTP/1.1 Connector on port 8080
-->
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443"
maxParameterCount="1000"
/>

<Engine name="Catalina" defaultHost="localhost">

<!--For clustering, please take a look at documentation at:
/docs/cluster-howto.html (simple how to)
/docs/config/cluster.html (reference documentation) -->
<!--
<Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"/>
-->

<!-- Use the LockOutRealm to prevent attempts to guess user passwords
via a brute-force attack -->
<Realm className="org.apache.catalina.realm.LockOutRealm">
<!-- This Realm uses the UserDatabase configured in the global JNDI
resources under the key "UserDatabase". Any edits
that are performed against this UserDatabase are immediately
available for use by the Realm. -->
<Realm className="org.apache.catalina.realm.UserDatabaseRealm"
resourceName="UserDatabase"/>
</Realm>

<Host name="localhost" appBase="webapps"
unpackWARs="true" autoDeploy="true">

<!-- SingleSignOn valve, share authentication between web applications
Documentation at: /docs/config/valve.html -->
<!--
<Valve className="org.apache.catalina.authenticator.SingleSignOn" />
-->

<Valve className="ch.qos.logback.access.tomcat.LogbackValve"/>

</Host>
</Engine>
</Service>
</Server>
Loading