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

fix: Adding configurable timezone support for log timestamps #3955

Open
wants to merge 8 commits into
base: v3.x.x
Choose a base branch
from
1 change: 1 addition & 0 deletions caching-service-package/src/main/resources/bin/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,7 @@ _BPX_JOBNAME=${ZWE_zowe_job_prefix}${CACHING_CODE} ${JAVA_BIN_DIR}java \
-Djava.io.tmpdir=${TMPDIR:-/tmp} \
-Dspring.profiles.active=${ZWE_configs_spring_profiles_active:-} \
-Dapiml.logs.location=${ZWE_zowe_logDirectory} \
-Dapiml.logging.timezone=${ZWE_zowe_logging_timezone:UTC} \
-Dapiml.health.protected=${ZWE_configs_apiml_health_protected:-true} \
-Dapiml.service.port=${ZWE_configs_port:-7555} \
-Dapiml.service.hostname=${ZWE_haInstance_hostname:-localhost} \
Expand Down
1 change: 1 addition & 0 deletions caching-service/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ logging:
org.apache.tomcat.util.net.SSLUtilBase: ERROR
org.springframework.security.config.annotation.web.builders.WebSecurity: ERROR
javax.net.ssl: ERROR
timezone: ${apiml.logging.timezone:UTC}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please describe this field in the additional-spring-configuration-metadata.json. Ideally with sample values.


eureka:
client:
Expand Down
3 changes: 2 additions & 1 deletion caching-service/src/main/resources/logback.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
<property name="MIN_INDEX" value="${rollingPolicy.minIndex:-1}"/>
<property name="MAX_FILE_SIZE" value="${rollingPolicy.file.maxSize:-50MB}"/>
<property name="STORAGE_LOCATION" value="${apiml.logs.location}" />
<property name="apimlLogPattern" value="%d{yyyy-MM-dd HH:mm:ss.SSS,UTC} %clr&lt;${logbackService:-${logbackServiceName}}:%thread:${PID:- }&gt; %magenta(%X{userid:-}) %cyan(%-5level) %clr\(\(%logger{15}\)\) %msg%n"/>
<property name="LOGGING_TIMEZONE" value="${logging.timezone:-UTC}"/>
<property name="apimlLogPattern" value="%d{yyyy-MM-dd HH:mm:ss.SSS,${LOGGING_TIMEZONE}} %clr&lt;${logbackService:-${logbackServiceName}}:%thread:${PID:- }&gt; %magenta(%X{userid:-}) %cyan(%-5level) %clr\(\(%logger{15}\)\) %msg%n"/>

<turboFilter class="org.zowe.apiml.product.logging.UseridFilter"/>
<if condition='property("spring.profiles.active").contains("debug")||property("spring.profiles.active").contains("diag")||property("spring.profiles.active").contains("dev")'>
Expand Down
1 change: 1 addition & 0 deletions gateway-package/src/main/resources/bin/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,7 @@ _BPX_JOBNAME=${ZWE_zowe_job_prefix}${GATEWAY_CODE} ${JAVA_BIN_DIR}java \
-Dapiml.connection.idleConnectionTimeoutSeconds=${ZWE_configs_apiml_connection_idleConnectionTimeoutSeconds:-5} \
-Dapiml.connection.timeToLive=${ZWE_configs_apiml_connection_timeToLive:-10000} \
-Dapiml.logs.location=${ZWE_zowe_logDirectory} \
-Dapiml.logging.timezone=${ZWE_zowe_logging_timezone:UTC} \
-Dapiml.health.protected=${ZWE_configs_apiml_health_protected:-true} \
-Dapiml.security.ssl.verifySslCertificatesOfServices=${verifySslCertificatesOfServices} \
-Dapiml.security.ssl.nonStrictVerifySslCertificatesOfServices=${nonStrictVerifySslCertificatesOfServices:-false} \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,12 @@
"type": "java.util.Set",
"defaultValue": false,
"description": "Specifies what custom metadata are displayed in the /registry endpoint."
},
{
"name": "apiml.logging.timezone",
"type": "java.lang.String",
"defaultValue": "UTC",
"description": "Specifies the timezone to be used for logging."
}
]
}
1 change: 1 addition & 0 deletions gateway-service/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ logging:
io.netty.resolver.dns: WARN
javax.net.ssl: ERROR
org.apache.tomcat.util.net.SSLUtilBase: ERROR
timezone: ${apiml.logging.timezone:UTC}

management:
endpoint:
Expand Down
3 changes: 2 additions & 1 deletion gateway-service/src/main/resources/logback-gateway.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
<property name="MIN_INDEX" value="${rollingPolicy.minIndex:-1}"/>
<property name="MAX_FILE_SIZE" value="${rollingPolicy.file.maxSize:-50MB}"/>
<property name="STORAGE_LOCATION" value="${apiml.logs.location}" />
<property name="apimlLogPattern" value="%d{yyyy-MM-dd HH:mm:ss.SSS,UTC} %clr&lt;${logbackService:-${logbackServiceName}}:%thread:${PID:- }&gt; %magenta(%X{userid:-}) %cyan(%-5level) %clr\(\(%logger{15}\)\) %msg%n"/>
<property name="LOGGING_TIMEZONE" value="${logging.timezone:-UTC}"/>
<property name="apimlLogPattern" value="%d{yyyy-MM-dd HH:mm:ss.SSS,${LOGGING_TIMEZONE}} %clr&lt;${logbackService:-${logbackServiceName}}:%thread:${PID:- }&gt; %magenta(%X{userid:-}) %cyan(%-5level) %clr\(\(%logger{15}\)\) %msg%n"/>

<turboFilter class="org.zowe.apiml.product.logging.UseridFilter"/>
<if condition='property("spring.profiles.active").contains("debug")||property("spring.profiles.active").contains("diag")||property("spring.profiles.active").contains("dev")'>
Expand Down
1 change: 1 addition & 0 deletions zaas-package/src/main/resources/bin/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,7 @@ _BPX_JOBNAME=${ZWE_zowe_job_prefix}${ZAAS_CODE} ${JAVA_BIN_DIR}java \
-Dapiml.connection.idleConnectionTimeoutSeconds=${ZWE_configs_apiml_connection_idleConnectionTimeoutSeconds:-5} \
-Dapiml.cache.storage.location=${ZWE_zowe_workspaceDirectory}/api-mediation/${ZWE_haInstance_id:-localhost} \
-Dapiml.logs.location=${ZWE_zowe_logDirectory} \
-Dapiml.logging.timezone=${ZWE_zowe_logging_timezone:UTC} \
-Dapiml.security.ssl.verifySslCertificatesOfServices=${verifySslCertificatesOfServices:-true} \
-Dapiml.security.ssl.nonStrictVerifySslCertificatesOfServices=${nonStrictVerifySslCertificatesOfServices:-false} \
-Dapiml.security.auth.zosmf.serviceId=${ZWE_configs_apiml_security_auth_zosmf_serviceId:-${ZWE_components_gateway_apiml_security_auth_zosmf_serviceId:-ibmzosmf}} \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@
"name": "apiml.security.oidc.registry",
"type": "java.lang.String",
"description": "Specifies the distributed identities registry that will be used for identity mapping."
},
{
"name": "apiml.logging.timezone",
"type": "java.lang.String",
"defaultValue": "UTC",
"description": "Specifies the timezone to be used for logging."
}
]
}
1 change: 1 addition & 0 deletions zaas-service/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ logging:
org.apache.http.conn.ssl.DefaultHostnameVerifier: DEBUG #logs only SSLException
org.eclipse.jetty.util.ssl: ERROR
org.apache.tomcat.util.net.SSLUtilBase: ERROR
timezone: ${apiml.logging.timezone:UTC}

apiml:
service:
Expand Down
3 changes: 2 additions & 1 deletion zaas-service/src/main/resources/logback-zaas.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
<property name="MIN_INDEX" value="${rollingPolicy.minIndex:-1}"/>
<property name="MAX_FILE_SIZE" value="${rollingPolicy.file.maxSize:-50MB}"/>
<property name="STORAGE_LOCATION" value="${apiml.logs.location}" />
<property name="apimlLogPattern" value="%d{yyyy-MM-dd HH:mm:ss.SSS,UTC} %clr&lt;${logbackService:-${logbackServiceName}}:%thread:${PID:- }&gt; %magenta(%X{userid:-}) %cyan(%-5level) %clr\(\(%logger{15}\)\) %msg%n"/>
<property name="LOGGING_TIMEZONE" value="${logging.timezone:-UTC}"/>
<property name="apimlLogPattern" value="%d{yyyy-MM-dd HH:mm:ss.SSS,${LOGGING_TIMEZONE}} %clr&lt;${logbackService:-${logbackServiceName}}:%thread:${PID:- }&gt; %magenta(%X{userid:-}) %cyan(%-5level) %clr\(\(%logger{15}\)\) %msg%n"/>

<turboFilter class="org.zowe.apiml.product.logging.UseridFilter"/>
<if condition='property("spring.profiles.active").contains("debug")||property("spring.profiles.active").contains("diag")||property("spring.profiles.active").contains("dev")'>
Expand Down
Loading