14.3.5. Configurer un log handler périodique dans le CLI
- Ajouter un nouveau log handler périodique.
- Afficher la configuration d'un log handler périodique
- Définir le niveau de journalisation du handler.
- Définir le comportement d'ajout du handler.
- Définir si le handler utilise autoflush ou non.
- Définir la codification utilisée pour la sortie du handler.
- Indiquer le fichier dans lequel le log handler écrit.
- Définir le formateur utilisé pour la sortie du handler.
- Définir le suffixe pour les journaux en rotation
- Supprimer un log handler périodique
Important
/subsystem=logging/logging-profile=NAME/ au lieu de /subsystem=logging/.
- Ajouter un nouveau log handler périodique en rotation.
- Utiliser l'opération
addavec la syntaxe suivante./subsystem=logging/periodic-rotating-file-handler=HANDLER:add(file={"path"=>"PATH", "relative-to"=>"DIR"}, suffix="SUFFIX")/subsystem=logging/periodic-rotating-file-handler=HANDLER:add(file={"path"=>"PATH", "relative-to"=>"DIR"}, suffix="SUFFIX")Copy to Clipboard Copied! Toggle word wrap Toggle overflow Remplacer HANDLER par le nom du log handler. Remplacer PATH par le nom du fichier dans lequel le log est écrit. Remplacer DIR par le nom du répertoire dans lequel le fichier se trouve. La valeur DIR peut correspondre à une variable de chemin. Remplacer SUFFIX par le suffixe de rotation de fichiers à utiliser.Exemple 14.29. Créer un nouvel handler
[standalone@localhost:9999 /] /subsystem=logging/periodic-rotating-file-handler=HOURLY_DEBUG:add(file={"path"=>"daily-debug.log", "relative-to"=>"jboss.server.log.dir"}, suffix=".yyyy.MM.dd") {"outcome" => "success"} [standalone@localhost:9999 /][standalone@localhost:9999 /] /subsystem=logging/periodic-rotating-file-handler=HOURLY_DEBUG:add(file={"path"=>"daily-debug.log", "relative-to"=>"jboss.server.log.dir"}, suffix=".yyyy.MM.dd") {"outcome" => "success"} [standalone@localhost:9999 /]Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Afficher une configuration de log handler de fichiers en rotation périodique
- Utiliser l'opération
read-resourceavec la syntaxe suivante./subsystem=logging/periodic-rotating-file-handler=HANDLER:read-resource
/subsystem=logging/periodic-rotating-file-handler=HANDLER:read-resourceCopy to Clipboard Copied! Toggle word wrap Toggle overflow Remplacer HANDLER par le nom du log handler.Exemple 14.30. Utiliser l'opération read-resource
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Définir le niveau de journalisation
- Utiliser l'opération
write-attributeavec la syntaxe suivante./subsystem=logging/periodic-rotating-file-handler=HANDLER:write-attribute(name="level". value="LOG_LEVEL_VALUE")
/subsystem=logging/periodic-rotating-file-handler=HANDLER:write-attribute(name="level". value="LOG_LEVEL_VALUE")Copy to Clipboard Copied! Toggle word wrap Toggle overflow Remplacer HANDLER par le nom du log handler périodique et LOG_LEVEL_VALUE par le niveau de journalisation à définir.Exemple 14.31. Définir le niveau de journalisation
[standalone@localhost:9999 /] /subsystem=logging/periodic-rotating-file-handler=HOURLY_DEBUG:write-attribute(name="level", value="DEBUG") {"outcome" => "success"}[standalone@localhost:9999 /] /subsystem=logging/periodic-rotating-file-handler=HOURLY_DEBUG:write-attribute(name="level", value="DEBUG") {"outcome" => "success"}Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Définir le comportement d'ajout
- Utiliser l'opération
write-attributeavec la syntaxe suivante./subsystem=logging/periodic-rotating-handler=HANDLER:write-attribute(name="append", value="BOOLEAN")
/subsystem=logging/periodic-rotating-handler=HANDLER:write-attribute(name="append", value="BOOLEAN")Copy to Clipboard Copied! Toggle word wrap Toggle overflow Remplacer HANDLER par le nom du log handler périodique. Remplacer BOOLÉEN parfalsesi vous souhaitez qu'un nouveau fichier de journalisation soit créé à chaque fois qu'un serveur d'applications est lancé. Remplacer BOOLÉEN partruesi le serveur d'applications doit continuer à utiliser le même fichier.JBoss EAP 6 doit démarrer à nouveau pour prendre effet.Exemple 14.32. Définir le comportement d'ajout
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Définir auto flush
- Utiliser l'opération
write-attributeavec la syntaxe suivante./subsystem=logging/periodic-rotating-file-handler=HANDLER:write-attribute(name="autoflush", value="BOOLEAN")
/subsystem=logging/periodic-rotating-file-handler=HANDLER:write-attribute(name="autoflush", value="BOOLEAN")Copy to Clipboard Copied! Toggle word wrap Toggle overflow Remplacer HANDLER par le nom du log handler périodique et BOOLEAN partruesi le handler doit écrire sa sortie immédiatement.JBoss EAP 6 doit démarrer à nouveau pour prendre effet.Exemple 14.33. Définir le comportement auto flush
[standalone@localhost:9999 /] /subsystem=logging/periodic-rotating-file-handler=HOURLY_DEBUG:write-attribute(name="autoflush", value="false") { "outcome" => "success", "response-headers" => {"process-state" => "reload-required"} }[standalone@localhost:9999 /] /subsystem=logging/periodic-rotating-file-handler=HOURLY_DEBUG:write-attribute(name="autoflush", value="false") { "outcome" => "success", "response-headers" => {"process-state" => "reload-required"} }Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Définir le codage
- Utiliser l'opération
write-attributeavec la syntaxe suivante./subsystem=logging/periodic-rotating-file-handler=HANDLER:write-attribute(name="encoding", value="ENCODING")
/subsystem=logging/periodic-rotating-file-handler=HANDLER:write-attribute(name="encoding", value="ENCODING")Copy to Clipboard Copied! Toggle word wrap Toggle overflow Remplacer HANDLER par le nom du log handler périodique et ENCODING par le nom de codification du caractère qui convient.Exemple 14.34. Définir le codage
[standalone@localhost:9999 /] /subsystem=logging/periodic-rotating-file-handler=HOURLY_DEBUG:write-attribute(name="encoding", value="utf-8") {"outcome" => "success"}[standalone@localhost:9999 /] /subsystem=logging/periodic-rotating-file-handler=HOURLY_DEBUG:write-attribute(name="encoding", value="utf-8") {"outcome" => "success"}Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Changer le fichier dans lequel le log handler écrit.
- Utiliser l'opération
write-attributeavec la syntaxe suivante./subsystem=logging/periodic-rotating-file-handler=HANDLER:write-attribute(name="file", value={"path"=>"PATH", "relative-to"=>"DIR"})/subsystem=logging/periodic-rotating-file-handler=HANDLER:write-attribute(name="file", value={"path"=>"PATH", "relative-to"=>"DIR"})Copy to Clipboard Copied! Toggle word wrap Toggle overflow Remplacer HANDLER par le nom du log handler périodique. Remplacer PATH par le nom du fichier dans lequel le log est écrit. Remplacer DIR par le nom du répertoire dans lequel le fichier se trouve. La valeur DIR peut correspondre à une variable de chemin.Exemple 14.35. Changer le fichier dans lequel le log handler écrit.
[standalone@localhost:9999 /] /subsystem=logging/periodic-rotating-file-handler=HOURLY_DEBUG:write-attribute(name="file", value={"path"=>"daily-debug.log", "relative-to"=>"jboss.server.log.dir"}) {"outcome" => "success"}[standalone@localhost:9999 /] /subsystem=logging/periodic-rotating-file-handler=HOURLY_DEBUG:write-attribute(name="file", value={"path"=>"daily-debug.log", "relative-to"=>"jboss.server.log.dir"}) {"outcome" => "success"}Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Définir le formateur
- Utiliser l'opération
write-attributeavec la syntaxe suivante./subsystem=logging/periodic-rotating-file-handler=HANDLER:write-attribute(name="formatter", value="FORMAT")
/subsystem=logging/periodic-rotating-file-handler=HANDLER:write-attribute(name="formatter", value="FORMAT")Copy to Clipboard Copied! Toggle word wrap Toggle overflow Remplacer HANDLER par le nom du log handler périodique et FORMAT par le string de formateur à définir.Exemple 14.36. Définir le formateur
[standalone@localhost:9999 /] /subsystem=logging/periodic-rotating-file-handler=HOURLY_DEBUG:write-attribute(name="formatter", value="%d{HH:mm:ss,SSS} %-5p [%c] (%t) %s%E%n") {"outcome" => "success"} [standalone@localhost:9999 /][standalone@localhost:9999 /] /subsystem=logging/periodic-rotating-file-handler=HOURLY_DEBUG:write-attribute(name="formatter", value="%d{HH:mm:ss,SSS} %-5p [%c] (%t) %s%E%n") {"outcome" => "success"} [standalone@localhost:9999 /]Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Définir le suffixe pour les journaux en rotation
- Utiliser l'opération
write-attributeavec la syntaxe suivante./subsystem=logging/periodic-rotating-file-handler=HANDLER:write-attribute(name="suffix", value="SUFFIX")
/subsystem=logging/periodic-rotating-file-handler=HANDLER:write-attribute(name="suffix", value="SUFFIX")Copy to Clipboard Copied! Toggle word wrap Toggle overflow Remplacer HANDLER par le nom du log handler et SUFFIX par le string de suffixe à définir.Exemple 14.37.
[standalone@localhost:9999 /] /subsystem=logging/periodic-rotating-file-handler=HOURLY_DEBUG:write-attribute(name="suffix", value=".yyyy-MM-dd-HH") {"outcome" => "success"} [standalone@localhost:9999 /][standalone@localhost:9999 /] /subsystem=logging/periodic-rotating-file-handler=HOURLY_DEBUG:write-attribute(name="suffix", value=".yyyy-MM-dd-HH") {"outcome" => "success"} [standalone@localhost:9999 /]Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Supprimer un log handler périodique
- Utiliser l'opération
removeavec la syntaxe suivante./subsystem=logging/periodic-rotating-file-handler=HANDLER:remove
/subsystem=logging/periodic-rotating-file-handler=HANDLER:removeCopy to Clipboard Copied! Toggle word wrap Toggle overflow Remplacer HANDLER par le nom du log handler périodique.Exemple 14.38. Supprimer un log handler périodique
[standalone@localhost:9999 /] /subsystem=logging/periodic-rotating-file-handler=HOURLY_DEBUG:remove {"outcome" => "success"} [standalone@localhost:9999 /][standalone@localhost:9999 /] /subsystem=logging/periodic-rotating-file-handler=HOURLY_DEBUG:remove {"outcome" => "success"} [standalone@localhost:9999 /]Copy to Clipboard Copied! Toggle word wrap Toggle overflow