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

Do not log into zowe.runtimeDirectory #317

Merged
merged 10 commits into from
Nov 11, 2024
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
Loading