13.3.6. Configurer un Log Handler Taille dans le CLI
- Ajouter un nouveau Log Handler
- Afficher la configuration du Log Handler
- 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 la taille maximum de chaque fichier de journalisation
- Définir le nombre maximum de journaux de sauvegarde à conserver
- Supprimer un Log Handler.
Important
/subsystem=logging/logging-profile=NAME/ au lieu de /subsystem=logging/.
- Ajouter un nouveau Log Handler
- Utiliser l'opération
addavec la syntaxe suivante./subsystem=logging/size-rotating-file-handler=HANDLER:add(file={"path"=>"PATH", "relative-to"=>"DIR"})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.Exemple 13.39. Ajouter un nouveau Log Handler
[standalone@localhost:9999 /] /subsystem=logging/size-rotating-file-handler=ACCOUNTS_TRACE:add(file={"path"=>"accounts_trace.log", "relative-to"=>"jboss.server.log.dir"}) {"outcome" => "success"} [standalone@localhost:9999 /] - Afficher la configuration du Log Handler
- Utiliser l'opération
read-resourceavec la syntaxe suivante./subsystem=logging/size-rotating-file-handler=HANDLER:read-resourceRemplacer HANDLER par le nom du Log Handler.Exemple 13.40. Afficher la configuration du Log Handler
[standalone@localhost:9999 /] /subsystem=logging/size-rotating-file-handler=ACCOUNTS_TRACE:read-resource { "outcome" => "success", "result" => { "append" => true, "autoflush" => true, "encoding" => undefined, "file" => { "path" => "accounts_trace.log", "relative-to" => "jboss.server.log.dir" }, "filter" => undefined, "formatter" => "%d{HH:mm:ss,SSS} %-5p [%c] (%t) %s%E%n", "level" => undefined, "max-backup-index" => 1, "rotate-size" => "2m" } } [standalone@localhost:9999 /] - Définir le niveau de journalisation. du handler
- Utiliser l'opération
change-log-levelavec la syntaxe suivante./subsystem=logging/size-rotating-file-handler=HANDLER:change-log-level(level="LEVEL")Remplacer HANDLER par le nom du Log Handler et LEVEL par le niveau de journalisation à définir.Exemple 13.41. Définir le niveau de journalisation. du handler
[standalone@localhost:9999 /] /subsystem=logging/size-rotating-file-handler=ACCOUNTS_TRACE:change-log-level(level="TRACE") {"outcome" => "success"} [standalone@localhost:9999 /] - Définir le comportement d'ajout du handler
- Utiliser l'opération
write-attributeavec la syntaxe suivante./subsystem=logging/size-rotating-file-handler=HANDLER:write-attribute(name="append", value="BOOLEAN")Remplacer HANDLER par le nom du Log Handler. 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 Enterprise Application Platform 6 doit démarrer à nouveau pour prendre effet.Exemple 13.42. Définir le comportement d'ajout du handler
[standalone@localhost:9999 /] /subsystem=logging/size-rotating-file-handler=ACCOUNTS_TRACE:write-attribute(name="append", value="true") { "outcome" => "success", "response-headers" => { "operation-requires-reload" => true, "process-state" => "reload-required" } } [standalone@localhost:9999 /] - Définir si le handler utilise autoflush ou non
- Utiliser l'opération
write-attributeavec la syntaxe suivante./subsystem=logging/size-rotating-file-handler=HANDLER:write-attribute(name="autoflush", value="BOOLEAN")Remplacer HANDLER par le nom du Log Handler et BOOLEAN partruesi le handler doit écrite sa sortie immédiatement.Exemple 13.43. Définir si le handler utilise autoflush ou non
[standalone@localhost:9999 /] /subsystem=logging/size-rotating-file-handler=ACCOUNTS_TRACE:write-attribute(name="autoflush", value="true") {"outcome" => "success"} [standalone@localhost:9999 /] - Définir la codification utilisée pour la sortie du handler
- Utiliser l'opération
write-attributeavec la syntaxe suivante./subsystem=logging/size-rotating-file-handler=HANDLER:write-attribute(name="encoding", value="ENCODING")Remplacer HANDLER par le nom du Log Handler et ENCODING par le nom de codification du caractère qui convient.Exemple 13.44. Définir la codification utilisée pour la sortie du handler
[standalone@localhost:9999 /] /subsystem=logging/size-rotating-file-handler=ACCOUNTS_TRACE:write-attribute(name="encoding", value="utf-8") {"outcome" => "success"} [standalone@localhost:9999 /] - Indiquer le fichier dans lequel le Log Handler écrit
- Utiliser l'opération
change-fileavec la syntaxe suivante./subsystem=logging/size-rotating-file-handler=HANDLER:change-file(file={"path"=>"PATH", "relative-to"=>"DIR"})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.Exemple 13.45. Indiquer le fichier dans lequel le Log Handler écrit
[standalone@localhost:9999 /] /subsystem=logging/size-rotating-file-handler=ACCOUNTS_TRACE:change-file(file={"path"=>"accounts_trace.log", "relative-to"=>"jboss.server.log.dir"}) {"outcome" => "success"} [standalone@localhost:9999 /] - Définir le formateur utilisé pour la sortie du handler.
- Utiliser l'opération
write-attributeavec la syntaxe suivante./subsystem=logging/size-rotating-file-handler=HANDLER:write-attribute(name="formatter", value="FORMATTER")Remplacer HANDLER par le nom du Log Handler et FORMAT par le string de formateur à définir.Exemple 13.46. Définir le formateur utilisé pour la sortie du handler.
[standalone@localhost:9999 /] /subsystem=logging/size-rotating-file-handler=ACCOUNTS_TRACE:write-attribute(name="formatter", value="%d{HH:mm:ss,SSS} %-5p (%c) [%t] %s%E%n") {"outcome" => "success"} [standalone@localhost:9999 /] - Définir la taille maximum de chaque fichier de journalisation
- Utiliser l'opération
write-attributeavec la syntaxe suivante./subsystem=logging/size-rotating-file-handler=HANDLER:write-attribute(name="rotate-size", value="SIZE")Remplacer HANDLER par le nom du Log Handler et SIZE par la taille de fichier maximum.Exemple 13.47. Définir la taille maximum de chaque fichier de journalisation
[standalone@localhost:9999 /] /subsystem=logging/size-rotating-file-handler=ACCOUNTS_TRACE:write-attribute(name="rotate-size", value="50m") {"outcome" => "success"} [standalone@localhost:9999 /] - Définir le nombre maximum de journaux de sauvegarde à conserver
- Utiliser l'opération
write-attributeavec la syntaxe suivante./subsystem=logging/size-rotating-file-handler=HANDLER:write-attribute(name="max-backup-index", value="NUMBER")Remplacer HANDLER par le nom du Log Handler et NUMBER par le nombre de fichiers de journalisation à conserver.Exemple 13.48. Définir le nombre maximum de journaux de sauvegarde à conserver
[standalone@localhost:9999 /] /subsystem=logging/size-rotating-file-handler=ACCOUNTS_TRACE:write-attribute(name="max-backup-index", value="5") {"outcome" => "success"} [standalone@localhost:9999 /] - Supprimer un Log Handler
- Utiliser l'opération
removeavec la syntaxe suivante./subsystem=logging/size-rotating-file-handler=HANDLER:removeRemplacer HANDLER par le nom du Log Handler.Exemple 13.49. Supprimer un Log Handler
[standalone@localhost:9999 /] /subsystem=logging/size-rotating-file-handler=ACCOUNTS_TRACE:remove {"outcome" => "success"} [standalone@localhost:9999 /]