[MAXIMO] - How to view SystemOut and SystemErr logs in Maximo App without accessing file server.
Mục đích
Mục đích quản trị viên hệ thống Maximo có thể nhanh chóng xem các bản ghi bên trong Maximo để duy trì, hỗ trợ và bắt nhật ký ngay lập tức.
Giải pháp
Đây là giải pháp rất đơn giản để tải tệp Systemout và Systemerr từ nhật ký Maximo. Bạn có thể áp dụng ý tưởng của mình dựa trên điều này, chẳng hạn như: Tải xuống các tệp nhật ký trực tiếp để điều tra sau. Tôi sẽ demo để tải và hiển thị tệp nhật ký SystemOut. Bạn có thể làm điều này cho SystemRrr theo cùng một cách.
1. Database Configuration
Non-persistent Object:
Object Name: VIEWSYSTEMOUT
Persistent: No
Service: CUSTAPP
Non-persistent Attribute: (you can define more attributes for SystemErr)
Attribute Name: VIEWLOGS | Type: ALN | Length: 100 | Long Description Owner: Yes
Attribute Name: VIEWLOGS_LONGDESCRIPTION | Type: LONGALN | Length: 32,000
2. Automation Scripts - Python
Launch Point:
LP Name: VIEWLOGS
Object: VIEWSYSTEMOUT
Events: Initialize Value
Python:
Script Name: S_VIEWLOGS
import os
#from psdi import Mbo
def fetch_system_logs():
try:
# Path to the log file
log_file_path = "C:/IBM/WebSphere/AppServer/profiles/ctgAppSrv01/logs/MXServer/SystemOut.log"
# Check if the file exists
#if not os.path.exists(log_file_path):
# return "Error: Log file not found."
# Read the last 32000 lines
with open(log_file_path, "r") as log_file:
lines = log_file.readlines()
return "".join(lines[-32000:]) # Last 32000 lines
except Exception as e:
return "Error reading logs" + str(e)
# Fetch logs and populate the LOGCONTENT field
log_content = fetch_system_logs()
if mbo:
#print("This is a debug message printed to SystemOut.log. " + mbo.getName())
mbo.setValue("VIEWLOGS_LONGDESCRIPTION", log_content)
else:
service.log("MBO object is not available. Check the launch point.")
3. Application Designer
New Dialog:
<dialog id="viewsystemoutlog" label="View System Out Logs" mboname="VIEWSYSTEMOUT">
<multilinetextbox columns="100" dataattribute="VIEWLOGS_LONGDESCRIPTION" id="viewsystemoutlog_textbox" inputmode="readonly" label="SYSTEM OUT LOGS" rows="30"/>
<buttongroup id="viewsystemoutlog_btgroup">
<pushbutton default="true" id="viewsystemoutlog_btnok" label="OK" mxevent="dialogok"/>
</buttongroup>
</dialog>
SigOption:
Name: VIEWSYSTEMOUTLOG
Description: View System Out Logs
Select Action Menu:
Element Type: OPTION
Key Value: VIEWSYSTEMOUTLOG
Position: 0
Subposition: 999
Visible: Yes
Tabs: LIST
4. Security Settings
- Security Group: MAXADMIN
- Application: Database Configuration
- Grant Access:
All Rights Reserved