Skip to content

Commit

Permalink
remove the printf
Browse files Browse the repository at this point in the history
Signed-off-by: 1000TurquoisePogs <[email protected]>
  • Loading branch information
1000TurquoisePogs committed Nov 9, 2023
2 parents f0e9d66 + 95eaed2 commit e7436f6
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
5 changes: 3 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@ All notable changes to the Zowe Launcher package will be documented in this file
This repo is part of the app-server Zowe Component, and the change logs here may appear on Zowe.org in that section.

## 2.13.0

- Bugfix: Changed timestamp to UTC to match the server timestamps (#103)
- Bugfix: Removed server timestamps from syslog to avoid duplicate logging of time (#103)
- Bugfix: Avoided hang on components when components were logging messages longer than 1024 characters. (#103)
- Enhancement: syslog output per line is capped at 512 bytes, extra characters will be omitted (#103)
- Enhancement: Added milliseconds logging to match the server timestamps (#103)
- Enhancement: Launcher prints a message at the beginning of startup to alert users whether or not their log output has long enough lines to be readable if sent to support. (#101)
- Added a wrapper for wtoPrintf3

## 2.12.0
- Added a wrapper for wtoPrintf3
- Bugfix: Fixed a gap in WTO syslog checking
- Bugfix: Fixed a gap in WTO syslog checking
7 changes: 4 additions & 3 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@ static int index_of_string_limited(const char *str, int len, const char *search_
#define ZWE_SYSMESSAGES_EXCLUDE_LEN 20

// matches YYYY-MM-DD starting with 2xxx.
// this regex was chosen because other patterns didnt seem to work with LE's regex library.
#define DATE_PREFIX_REGEXP_PATTERN "^[2-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9].*"

// zowe standard "YYYY-MM-DD HH-MM-SS.sss "
Expand All @@ -261,17 +262,16 @@ static void check_for_and_print_sys_message(const char* input_string) {
for (int i = 0; i < count; i++) {
const char *sys_message_id = jsonArrayGetString(zl_context.sys_messages, i);
if (sys_message_id && (index_of_string_limited(input_string, input_length, sys_message_id, 0, SYSLOG_MESSAGE_LENGTH_LIMIT) != -1)) {

//exclude "ZWE_zowe_sysMessages" messages to avoid spam.
if (memcmp("ZWE_zowe_sysMessages", input_string, ZWE_SYSMESSAGES_EXCLUDE_LEN)){

//truncate match for reasonable output
char syslog_string[SYSLOG_MESSAGE_LENGTH_LIMIT+1] = {0};
regex_t time_regex;
int regex_rc = regcomp(&time_regex, DATE_PREFIX_REGEXP_PATTERN, 0);
printf("regex rc=%d\n", regex_rc);
int match = regexec(&time_regex, input_string, 0, NULL, 0);
printf("match =%d, %d\n", match, REG_NOMATCH);
int offset = match == 0 ? DATE_PREFIX_LEN : 0;
printf("offset = %d\n", offset);
int length = SYSLOG_MESSAGE_LENGTH_LIMIT < (input_length-offset) ? SYSLOG_MESSAGE_LENGTH_LIMIT : input_length-offset;
memcpy(syslog_string, input_string+offset, length);
syslog_string[length] = '\0';
Expand Down Expand Up @@ -1676,6 +1676,7 @@ int main(int argc, char **argv) {
}

INFO(MSG_LAUNCHER_START);
INFO(MSG_LINE_LENGTH);
printf_wto(MSG_LAUNCHER_START); // Manual sys log print (messages not set here yet)

zl_config_t config = read_config(argc, argv);
Expand Down
1 change: 1 addition & 0 deletions src/msg.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@
#define MSG_CFG_LOAD_FAIL MSG_PREFIX "0072E" " Launcher Could not load configurations\n"
#define MSG_CFG_SCHEMA_FAIL MSG_PREFIX "0073E" " Launcher Could not load schemas, status=%d\n"
#define MSG_NO_LOG_CONTEXT MSG_PREFIX "0074E" " Log context was not created\n"
#define MSG_LINE_LENGTH "-- If you cant see '500' at the end of the line, your log is too short to read!80--------90------ 100----------------------125----------------------150----------------------175----------------------200----------------------225----------------------250----------------------275----------------------300----------------------325----------------------350----------------------375----------------------400----------------------425----------------------450----------------------475----------------------500\n"

#endif // MSG_H

Expand Down

0 comments on commit e7436f6

Please sign in to comment.