Skip to content

Log Management ​

ArchForge keeps two audit logs in the database: operation logs for annotated admin actions and login logs for every admin login attempt.

Operation Logs ​

How They Are Written ​

Handlers annotated with @Log are wrapped by LogAspect: it records who called, which module, a summary, the client IP and its location, OS and browser, and whether the call succeeded. The record is published as an event and saved asynchronously after the transaction commits (logTaskExecutor), so logging never slows down or fails the request.

Data Model — SysOperLog (sys_oper_log) ​

FieldTypeDescription
operIdLongPrimary key
usernameStringOperator
moduleStringModule (from @Log or the class)
summaryStringWhat was done (from @Log or the method)
ipStringClient IP (trusted proxies only — see Configuration)
addressStringIP location
systemNameStringOperating system
browserStringBrowser
statusInteger1 success, 0 failure
operatingTimeDateTimeWhen

API Endpoints ​

OperationLogController (server-admin):

MethodEndpointPermissionDescription
POST/admin/operation-logmonitor:operlog:listPaginated list
POST/admin/operation-log/deletemonitor:operlog:removeDelete selected entries
POST/admin/operation-log/clearmonitor:operlog:removeDelete all entries

Login Logs ​

How They Are Written ​

LoginService writes one record per admin login attempt — success and failure, with the reason in behavior.

Data Model — SysLoginLog (sys_login_log) ​

FieldTypeDescription
infoIdLongPrimary key
usernameStringLogin name
ipStringClient IP
addressStringIP location
systemNameStringOperating system
browserStringBrowser
statusInteger1 login succeeded, 0 login failed (2 logout and 3 registration are defined values)
behaviorStringMessage, e.g. "登录成功" / "登录失败"
loginTimeDateTimeWhen

API Endpoints ​

LoginLogController (server-admin):

MethodEndpointPermissionDescription
POST/admin/login-logmonitor:logininfor:listPaginated list
POST/admin/login-log/deletemonitor:logininfor:removeDelete selected entries
POST/admin/login-log/clearmonitor:logininfor:removeDelete all entries

Browser, OS and Location ​

  • User-Agent parsing uses Yauaa (UserAgentUtil).
  • IP location: private addresses show "内网IP"; public ones are looked up in the offline ip2region xdb files (downloaded and cached on first use), falling back to an online lookup (whois.pconline.com.cn).

Log Retention ​

Logs are kept until someone deletes them: individual entries, everything via clear, or your own scheduled job that removes old rows. Nothing is pruned automatically.

Service Layer ​

SysOperLogService and SysLoginLogService (admin-user api) — CRUD and paginated queries; the C-end dashboard also uses them for today's counts and the latest operations.

Released under the MIT License.