Skip to content

Commit

Permalink
Merge pull request #317 from zowe/v3.x/logging
Browse files Browse the repository at this point in the history
Do not log into `zowe.runtimeDirectory`
  • Loading branch information
1000TurquoisePogs authored Nov 11, 2024
2 parents 0ffc640 + 228e2a5 commit 7b63513
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 14 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Zlux App Server Changelog

All notable changes to the Zlux App Server package will be documented in this file.
## v3.1.0
- Enhancement: if no `zowe.logDirectory` is defined in config, logging is disabled. [(#317)](https://github.com/zowe/zlux-app-server/pull/317)

## v3.1.0
- Enhancement: app-server tries to detect ssh and telnet ports (used by terminals) automatically. [(#326)](https://github.com/zowe/zlux-app-server/pull/326)
Expand Down
35 changes: 21 additions & 14 deletions bin/utils/setup-logs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
# This program and the accompanying materials are
# made available under the terms of the Eclipse Public License v2.0 which accompanies
# this distribution, and is available at https://www.eclipse.org/legal/epl-v20.html
#
#
# SPDX-License-Identifier: EPL-2.0
#
#
# Copyright Contributors to the Zowe Project.

if [ -n "$ZWED_NODE_LOG_FILE" ]
Expand All @@ -21,26 +21,33 @@ else
then
ZWED_NODE_LOG_DIR=${ZWE_zowe_logDirectory}
elif [ -n "${HOME}" ]; then
ZWED_NODE_LOG_DIR="${HOME}/.zowe/logs"
ZWED_NODE_LOG_DIR="${HOME}/.zowe/logs"
else
ZWED_NODE_LOG_DIR="../log"
if [ -z "${ZWE_zowe_runtimeDirectory}" ]; then
ZWED_NODE_LOG_DIR="../log"
else
echo "No log directory. Logging disabled."
ZWED_NODE_LOG_DIR=
ZWED_NODE_LOG_FILE=/dev/null
fi
fi
fi

if [ -f "$ZWED_NODE_LOG_DIR" ]
then
ZWED_NODE_LOG_FILE=$ZWED_NODE_LOG_DIR
elif [ ! -d "$ZWED_NODE_LOG_DIR" ]
then
echo "Will make log directory $ZWED_NODE_LOG_DIR"
mkdir -p $ZWED_NODE_LOG_DIR
if [ $? -ne 0 ]
then
echo "Cannot make log directory. Logging disabled."
ZWED_NODE_LOG_FILE=/dev/null
if [ -n "$ZWED_NODE_LOG_DIR" ]; then
echo "Will make log directory $ZWED_NODE_LOG_DIR"
mkdir -p $ZWED_NODE_LOG_DIR
if [ $? -ne 0 ]; then
echo "Cannot make log directory. Logging disabled."
ZWED_NODE_LOG_FILE=/dev/null
fi
fi
fi

ZLUX_ROTATE_LOGS=0
if [ -d "$ZWED_NODE_LOG_DIR" ] && [ -z "$ZWED_NODE_LOG_FILE" ]
then
Expand All @@ -58,9 +65,9 @@ else
if [ $ZWED_NODE_LOGS_TO_KEEP -ge 0 ]
then
ZLUX_ROTATE_LOGS=1
fi
fi
fi

#Clean up excess logs, if appropriate.
if [ $ZLUX_ROTATE_LOGS -ne 0 ]
then
Expand Down

0 comments on commit 7b63513

Please sign in to comment.