Start with DEBUG or TRACE for your code ▪ After some time upgrade to WARN ▪ Split output to several files (app logic, SQL, exchange with other systems, security) 33
across many nodes ▪ Generate big amounts of logs ▪ Introduces problem of tracking single request • Add an unique call id and pass it to all nodes during req • Add the unique call id to all logs (through MDC for ex)
/ implement dynamic level change • Through observed logger config or JMX • Crucial on production when problem occurs ▪ Discuss rules with all Teams and sign it with blood
but not on production - you need logs ▪ If you’d have to perform post-mortem debugging/analysis on remote system, you need good logs ▪ If you’d support legacy system you will appreciate good logging
an evidence that other Vendor’s system failed - not yours ▪ From Bank or Telecom you will only get (obfuscated) logs ▪ Tell Application Support guys that you don’t have logs in your app
some kind of ID (UUID) and store it in logs with stacktrace ▪ Present User with error ID. They will help you discover error faster } catch (HttpClientErrorException e) { String errorID = UUID.randomUUID().toString(); log.error("Error fetching billing for phoneNo [{}]. Error ID [{}]", phoneNo, errorID, e); throw new ApplicationException(String.format("Error occurred while fetching billing. Error ID [%s]. Our engineers are fixing this!", errorID), e); }