zowe / zlux

The top-level superproject for zLUX. zLUX includes the Zowe Desktop framework in addition to several built-in apps and an example server implementation.
Eclipse Public License 2.0
38 stars 42 forks source link

How to disable ANSI coloring for logging #814

Open Martin-Zeithaml opened 2 years ago

Martin-Zeithaml commented 2 years ago

I have a joblog (zowe instance) from customer and the log contains the ANSI color codes. It seems, that due to the file being downloaded from mainframe (probably SDSF in raw format) and uploaded to our support ftp, the ANSI escape sequences and '[' is converted to some garbage. It looks like, the "garbage" is consistent, so it is possible to replace it or translate it to anything (however it is extra work :smirk:)

But is there a possibility (parameter, some setting) to completely suppress ANSI coloring in the logs?

1000TurquoisePogs commented 2 years ago

Lets identify which servers the colors are coming from, so we can talk to each group about having some sort of switch in their config to enable/disable colors. Totally reasonable request in my opinion.

Martin-Zeithaml commented 2 years ago

It seems, that for the log I have, the APIML_DEBUG_MODE_ENABLED=true caused those ANSI messages.

These are the unique processes from the log with ANSI coloring:

ZWEEAJ1:background-preinit:33622031
ZWEEAD1:main:16844817
ZWEEAJ1:main:33622031
ZWEACS1:main:83953597
ZWEACS1:DiscoveryClient-CacheRefreshExecutor-0:83953597
ZWEACS1:DiscoveryClient-HeartbeatExecutor-0:83953597
ZWEACS1:Apache-HttpClient-Conn-Cleaner2:83953597
Martin-Zeithaml commented 2 years ago

Small update: if the log was created via JCOPYOUT.DATASET in CA SYSVIEW, then the optional control characters A or M for the record format will cause the ANSI codes to be saved. For example: use Record Format VB for printable characters only and VBA for raw log with control characters.

1000TurquoisePogs commented 2 years ago

@AdarshdeepCheema do you know what library is used to do logging on the jobs and datasets api? We probably should disable colors by default (seems only useful during dev?)

Martin-Zeithaml commented 1 year ago

Also found in v2:

2022-08-21 01:46:13 <ZWELS:33947877> ZWESVUSR INFO (zwe-internal-start-prepare:343) Zowe version: v2.2.0
2022-08-21 01:56:56.902 <ZWEACS1:main:50727769> ZWESVUSR WARN  (o.a.t.u.n.SSLHostConfig) The protocol [TLSv1.3] was added to the list of protocols on the SSLHostConfig named [_default_]. Check if a +/- prefix is missing.
2022-08-21 01:56:58.150 <ZWEACS1:main:50727769> ZWESVUSR WARN  (o.z.a.u.ClassOrDefaultProxyUtils) Implementation com.ibm.jzos.ZUtil is not available with constructor signature [], it will continue with default one org.zowe.apiml.eurekaservice.client.impl.DefaultCustomMetadataHelper$$Lambda$691/0x00000000dc517d30@cfc8aa23 : Class org.zowe.apiml.util.ClassOrDefaultProxyUtils can not access a member of class com.ibm.jzos.ZUtil with modifiers "private"
2022-08-21 01:56:58.392 <ZWEACS1:main:50727769> ZWESVUSR WARN  (o.s.s.c.a.w.b.WebSecurity) You are asking Spring Security to ignore Ant [pattern='/application/health']. This is not recommended -- please use permitAll via HttpSecurity#authorizeHttpRequests instead.
2022-08-21 01:56:58.392 <ZWEACS1:main:50727769> ZWESVUSR WARN  (o.s.s.c.a.w.b.WebSecurity) You are asking Spring Security to ignore Ant [pattern='/application/info']. This is not recommended -- please use permitAll via HttpSecurity#authorizeHttpRequests instead.
2022-08-21 01:56:58.392 <ZWEACS1:main:50727769> ZWESVUSR WARN  (o.s.s.c.a.w.b.WebSecurity) You are asking Spring Security to ignore Ant [pattern='/v3/api-docs']. This is not recommended -- please use permitAll via HttpSecurity#authorizeHttpRequests instead.
2022-08-21 01:57:01.605 <ZWEACS1:main:50727769> ZWESVUSR WARN  (o.a.t.u.n.SSLUtilBase) The JSSE TLS 1.3 implementation does not support post handshake authentication (PHA) and is therefore incompatible with optional certificate authentication
2022-08-21 01:57:03.911 <ZWEACS1:main:50727769> ZWESVUSR INFO  (o.z.a.p.s.ServiceStartupEventHandler) ZWEAM000I Caching Service started in 14.822 seconds
2022-08-22 08:40:08.389 <ZWEACS1:DiscoveryClient-HeartbeatExecutor-1:50727769> ZWESVUSR ERROR (c.n.d.DiscoveryClient) DiscoveryClient_CACHINGSERVICE/example.com:cachingservice:12345 - was unable to send heartbeat!