El contenido no se encuentra disponible en el idioma seleccionado. Estamos trabajando continuamente para agregar más idiomas. Gracias por su apoyo.

Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Managed Threat Detection
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive

Log Analysis (SDK for Java)

Updated on 2024-06-18 GMT+08:00

How To Enable Logging

  1. Save the log4j2.xml file obtained from the OBS Java SDK package to the classpath root directory.
  2. Call Log4j2Configurator.setLogConfig to specify the save path of log4j2.xml directly.
NOTE:

You can obtain the default log configuration file log4j2.xml from the OBS Java SDK package, and then modify to customize the file.

Log Path

The log path of OBS Java SDK is specified in log4j2.xml. Logs are saved in the path represented by system variable user.dir of JDK by default. In general, there are three logs files as follows:

File Name

Description

OBS-SDK.interface_north.log

Northbound log file, which saves the logs about the communication between OBS Java SDK and third-party applications of users.

OBS-SDK.interface_south.log

Southbound log file, which saves the logs about the communication between OBS Java SDK and the OBS server.

OBS-SDK.access.log

Run log file of the OBS server.

Log Format

The SDK log format is: Log time|Thread number|Log level|Log content. The following are example logs:

#Southbound logs
2017-08-21 17:40:07 133|main|INFO |HttpClient cost 157 ms to apply http request
2017-08-21 17:40:07 133|main|INFO |Received expected response code: true
2017-08-21 17:40:07 133|main|INFO |expected code(s): [200, 204].

#Northbound logs
2017-08-21 17:40:06 820|main|INFO |Storage|1|HTTP+XML|ObsClient||||2017-08-21 17:40:05|2017-08-21 17:40:06|||0|
2017-08-21 17:40:07 136|main|INFO |Storage|1|HTTP+XML|setObjectAcl||||2017-08-21 17:40:06|2017-08-21 17:40:07|||0|
2017-08-21 17:40:07 137|main|INFO |ObsClient [setObjectAcl] cost 312 ms

Log Level

When current logs cannot be used to troubleshoot system faults, you can change the log level to obtain more information. You can obtain the most information in TRACE logs and the least information in ERROR logs.

Log level description:

  • OFF: Close level. If this level is set, logging will be disabled.
  • TRACE: Trace level. If this level is set, all log information will be printed. This level is not recommended.
  • DEBUG: Debugging level. If this level is set, information about logs of the INFO level and above, HTTP/HTTPS request and response headers, and StringToSign information calculated by authentication algorithm will be printed.
  • INFO: Information level. If this level is set, information about logs of the WARN level and above, time consumed for each HTTP/HTTPS request, and time consumed for calling the ObsClient API will be printed.
  • WARN: Warning level. If this level is set, information about logs of the ERROR level and above, as well as information about some critical events (for example, the number of retry attempts exceeds the upper limit) will be printed.
  • ERROR: Error level. If this level is set, only error information will be printed.

How to Set

The following sample code shows how to set different levels for the southbound logs, northbound logs, and OBS server run logs. (For details about log configuration, see configuration file log4j2.xml.)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
<!-- north log -->
<Logger name="com.obs.services.AbstractClient" level="INFO" additivity="false">
      <AppenderRef ref="NorthInterfaceLogAppender" />
</Logger>
        
<!-- south log -->
<Logger name="com.obs.services.internal.RestStorageService" level="WARN" additivity="false">
       <AppenderRef ref="SouthInterfaceLogAppender" />
</Logger>

<!-- access log -->
<Logger name="com.obs.log.AccessLogger" level="ERROR" additivity="false">
        <AppenderRef ref="AccessLogAppender" />
</Logger>

Utilizamos cookies para mejorar nuestro sitio y tu experiencia. Al continuar navegando en nuestro sitio, tú aceptas nuestra política de cookies. Descubre más

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback