AEM自定义日志未在Felix控制台Log Support中显示求助
Got it, let's work through this issue step by step since you can't create new log entries via Felix Log Support due to production permissions, and your existing CRXDE-created log config isn't showing up.
步骤1:检查自定义日志配置文件的命名与内容
First off, make sure your config file in /apps/system/config follows the correct naming convention and has all required properties:
- 文件名要求: It should be formatted as
org.apache.sling.commons.log.LogManager.factory.config-<your-log-id>.config(e.g.,org.apache.sling.commons.log.LogManager.factory.config-myapp-custom.log.config). This naming pattern tells OSGi it's a logging configuration. - 必要配置属性: Open the config file in CRXDE and verify it includes these key settings (adjust values to match your needs):
org.apache.sling.commons.log.level=INFO org.apache.sling.commons.log.file=logs/myapp-custom.log org.apache.sling.commons.log.pattern={0,date,dd.MM.yyyy HH:mm:ss.SSS} *{4}* [{2}] {3} {5} org.apache.sling.commons.log.names=com.yourcompany.yourprojectorg.apache.sling.commons.log.level: Sets the minimum log level (INFO, DEBUG, ERROR, etc.)org.apache.sling.commons.log.file: Path to your log file (use a relative path from AEM'scrx-quickstartfolder, likelogs/for standard log location)org.apache.sling.commons.log.names: The Java package(s) whose logs you want to capture (e.g., your project's code packages)
步骤2:确保节点类型为sling:OsgiConfig
OSGi won't recognize your config file unless it's set to the right node type:
- In CRXDE, right-click your config file node.
- Select Change Node Type.
- Choose
sling:OsgiConfigfrom the list and save.
步骤3:触发OSGi配置刷新
Since you can't use Felix console to reload configs, here's how to get the system to pick up your changes:
- Save and wait: Right-click your config file in CRXDE and select Save All. OSGi typically scans for config changes every few minutes, so give it 5-10 minutes to refresh.
- Command line refresh (if you have access): If you can run commands on the server, use this curl request to force a config reload (replace placeholders with your AEM details):
curl -u <admin-username>:<admin-password> -X POST http://<aem-host>:<port>/system/console/configMgr/org.apache.sling.commons.log.LogManager.factory.config-<your-log-id>
步骤4:验证日志生成与权限
- Check if your log file exists in AEM's
crx-quickstart/logsfolder (or the path you specified). If it's there and has content, the config is working—Felix Log Support just needs to catch up. - Ensure your config file has proper permissions in CRXDE: Right-click the node → Permissions → Make sure
everyonehas Read access. OSGi can't load configs it can't read.
步骤5:Troubleshooting if it still doesn't show up
If the log file exists but Felix Log Support still doesn't list it:
- Double-check the
org.apache.sling.commons.log.filepath—avoid absolute paths, stick to relative paths undercrx-quickstart. - If you're using a custom log path outside
logs/, verify the server user has write permissions to that directory. Production servers often restrict write access to non-standard locations.
Give these steps a shot, and your custom log should appear in Felix Log Support once the OSGi config is fully loaded.
内容的提问来源于stack exchange,提问作者Arunmozhi

