로그 생성이 안되어 테스트 및 수정본

This commit is contained in:
2026-03-20 09:33:30 +09:00
parent 80cb9451d2
commit bb07396abf
12 changed files with 205 additions and 23 deletions

View File

@@ -0,0 +1,27 @@
<?php
namespace App\Controllers;
class LogTest extends BaseController
{
public function index()
{
log_message('error', '===== WEB LOG TEST ===== ' . date('Y-m-d H:i:s'));
log_message('info', 'Info from web');
log_message('debug', 'Debug from web');
$logFile = WRITEPATH . 'logs/log-' . date('Y-m-d') . '.log';
echo "ENVIRONMENT: " . ENVIRONMENT . "<br>";
echo "Log file: " . $logFile . "<br>";
echo "Exists: " . (file_exists($logFile) ? 'YES' : 'NO') . "<br>";
echo "Writable: " . (is_writable(dirname($logFile)) ? 'YES' : 'NO') . "<br>";
if (file_exists($logFile)) {
echo "<h3>Last 20 lines:</h3>";
echo "<pre>";
echo htmlspecialchars(shell_exec('tail -20 ' . escapeshellarg($logFile)));
echo "</pre>";
}
}
}