Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion bin/libs/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,11 @@ print_formatted_message() {
return 0
fi

log_line_prefix="$(date -u '+%Y-%m-%d %T') <${service}:$$> $(get_user_id) ${level} (${logger})"
if [ "${ZWE_zowe_logging_timezone}" = "LOCAL" -o "${ZWE_zowe_logging_timezone}" = "local" ]; then
log_line_prefix="$(date '+%Y-%m-%d %T') <${service}:$$> $(get_user_id) ${level} (${logger})"
else
log_line_prefix="$(date -u '+%Y-%m-%d %T') <${service}:$$> $(get_user_id) ${level} (${logger})"
fi
while read -r line; do
has_prefix=$(echo "$line" | awk '/^[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}/')
if [ -z "${has_prefix}" ]; then
Expand Down
3 changes: 3 additions & 0 deletions bin/libs/configmgr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ let HA_CONFIGS = {};
export function getZoweConfig() {
if (ZOWE_CONFIG == null) {
ZOWE_CONFIG = loadZoweConfig();
if (ZOWE_CONFIG.zowe.logging?.timezone) {
std.setenv("ZWE_zowe_logging_timezone", ZOWE_CONFIG.zowe.logging.timezone);
}
}
return ZOWE_CONFIG
}
Expand Down
25 changes: 25 additions & 0 deletions bin/libs/strftime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,33 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/

import * as std from 'cm_std';

const MINUTE_MULTIPLIER = 60*1000;
const HOUR_MULTIPLIER = 60*60*1000;

export function strftime(sFormat:string, dateArg?:Date): string {
let date:Date = (dateArg instanceof Date) ? dateArg : new Date();
let tzenv = std.getenv("ZWE_PRIVATE_TIMEZONE_DIFF");
let timezonePreference = std.getenv("ZWE_zowe_logging_timezone") || '';
let useLocalTime = timezonePreference.toLowerCase() == 'local';
if (useLocalTime && tzenv && (tzenv.length == 5) && (tzenv != '+0000')) {
let operator = tzenv[0];
if (operator == '+' || operator == '-') {
let hourDiff = Number(tzenv.substring(1, 3));
let minuteDiff = Number(tzenv.substring(3, 5));
if (!isNaN(hourDiff) && !isNaN(minuteDiff)) {
let newTime = date.getTime();
let unixDiff = ((minuteDiff * MINUTE_MULTIPLIER) + (hourDiff * HOUR_MULTIPLIER));
if (operator == '+') {
date = new Date(newTime + unixDiff);
} else {
date = new Date(newTime - unixDiff);
}
}
}
}
const nDay = date.getDay();
const nDate = date.getDate();
const nMonth = date.getMonth();
Expand Down
3 changes: 3 additions & 0 deletions bin/zwe
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ if [ -z "${ZWE_zowe_runtimeDirectory}" ]; then
fi
export ZWE_zowe_runtimeDirectory

# Used to change from UTC time if needed
export ZWE_PRIVATE_TIMEZONE_DIFF=$(date '+%z')

#######################################################################
# import all shared libraries
if [ -z "${ZWE_PRIVATE_CLI_LIBRARY_LOADED}" ]; then
Expand Down
2 changes: 1 addition & 1 deletion manifest.json.template
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"artifact": "zowe-server-*.pax.Z"
},
"org.zowe.zlux.zlux-core": {
"version": "^3.0.0-V3.X-STAGING-ZLUX-CORE",
"version": "^3.4.0-zlux-server-framework-PR-572",
"artifact": "*.pax"
},
"org.zowe.zlux.sample-angular-app": {
Expand Down
12 changes: 12 additions & 0 deletions schemas/zowe-yaml-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -715,6 +715,18 @@
"description": "Customize how Zowe should validate certificates used by components or other services.",
"enum": ["STRICT", "NONSTRICT", "DISABLED"]
},
"logging": {
"type": "object",
"description": "Properties that instruct Zowe components and utilties when, how, and where log messages should be made.",
"additionalProperties": false,
"properties": {
"timezone": {
"type": "string",
"description": "Instructs messages to use either UTC, or the local timezone according to the TZ environment variable",
"enum": [ "LOCAL", "UTC" ]
}
}
},
"sysMessages": {
"type": "array",
"description": "List of Zowe message portions when matched will be additionally logged into the system's log (such as syslog on z/OS). Note: Some messages extremely early in the Zowe lifecycle may not be added to the system's log",
Expand Down
Loading