Add an admin-only server log viewer to the web UI
The root logger previously had no handler at all, so every module's logger.info() call (user creation, claims, password resets, ...) was silently dropped, not just unviewable. Adds a RotatingFileHandler writing into the existing /data volume so log content also survives container restarts/redeploys, plus /admin/logs (tail + line-count picker + full-file download) alongside the existing Users & Frames admin page.
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
<nav class="tabs">
|
||||
<a href="/admin" class="{% if active_admin_tab == 'main' %}active{% endif %}">Users & Frames</a>
|
||||
<a href="/admin/logs" class="{% if active_admin_tab == 'logs' %}active{% endif %}">Server Logs</a>
|
||||
</nav>
|
||||
@@ -4,6 +4,8 @@
|
||||
{% block page_title %}Administration{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
{% include "_admin_tabs.html" %}
|
||||
|
||||
{% if notice %}<div class="status ok">{{ notice }}</div>{% endif %}
|
||||
{% if error %}<div class="status err">{{ error }}</div>{% endif %}
|
||||
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
{% extends "app_base.html" %}
|
||||
|
||||
{% block title %}Server Logs{% endblock %}
|
||||
{% block page_title %}Administration{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
{% include "_admin_tabs.html" %}
|
||||
|
||||
<section class="card">
|
||||
<div class="card-title-row">
|
||||
<h2 class="card-title">Server Logs</h2>
|
||||
<a href="/admin/logs/download" class="secondary btn-inline">Download full log</a>
|
||||
</div>
|
||||
|
||||
{% if not log_exists %}
|
||||
<p class="sub">No log file yet -- nothing has been logged since this server last started.</p>
|
||||
{% else %}
|
||||
<p class="sub">Last {{ log_lines }} lines of <code>{{ log_path }}</code>. Rotates at ~2MB
|
||||
(older entries roll into <code>{{ log_path }}.1</code>, etc. -- not shown here; use
|
||||
"Download full log" for just the current file).</p>
|
||||
<div class="log-view-controls">
|
||||
{% for n in [200, 500, 2000, 5000] %}
|
||||
<a href="/admin/logs?lines={{ n }}" class="{% if log_lines == n %}active{% endif %}">{{ n }}</a>
|
||||
{% endfor %}
|
||||
<a href="/admin/logs?lines={{ log_lines }}" class="secondary btn-inline">Refresh</a>
|
||||
</div>
|
||||
<pre class="log-view">{{ log_text }}</pre>
|
||||
{% endif %}
|
||||
</section>
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user