type=page
status=published
title=set-log-attributes
next=set-log-file-format.html
prev=set-batch-runtime-configuration.html
~~~~~~

= set-log-attributes

[[set-log-attributes-1]][[GSRFM00227]][[set-log-attributes]]

== set-log-attributes

Sets the logging attributes for one or more loggers

[[sthref2041]]

=== Synopsis

[source]
----
asadmin [asadmin-options] set-log-attributes [--help]
[--target=target]
attribute-name=attribute-value[:attribute-name=attribute-value]*
----

[[sthref2042]]

=== Description

The `set-log-attributes` subcommand sets logging attributes for one or
more loggers. The attributes you can set correspond to the attributes
that are available in the `logging.properties` file for the domain.
Depending on the attributes you set, a server restart may be necessary.

This subcommand is supported in remote mode only.

[[sthref2043]]

=== Options

asadmin-options::
  Options for the `asadmin` utility. For information about these
  options, see the link:asadmin.html#asadmin-1m[`asadmin`(1M)] help page.
`--help`::
`-?`::
  Displays the help text for the subcommand.
`--target`::
  The server domain, instance, or cluster for which logger attributes
  will be set. If this option is omitted, attributes are set for the
  default server.

[[sthref2044]]

=== Operands

target::
  Valid values are:
  * server_name - Default target is `server`. If no target is specified
    then log attributes are set for the server.
  * cluster_name - The name of a target cluster.
  * instance_name - The name of a target server instance.
attribute-name::
  The fully scoped name of the logging attribute. The
  `list-log-attributes` subcommand can be used to list the names of all
  currently defined attributes.
attribute-value::
  The value to apply to the specified attribute. +
  The attribute values that can be specified include the following.
  Refer to "link:../administration-guide/logging.html#GSADG00010[Administering the Logging Service]" in
  GlassFish Server Open Source Edition Administration Guide for complete
  explanations of each of these values.

  `com.sun.enterprise.server.logging.GFFileHandler.alarms`;;
    Default is `false`.
  `com.sun.enterprise.server.logging.GFFileHandler.excludeFields`;;
    Default is an empty string.
  `com.sun.enterprise.server.logging.GFFileHandler.file`;;
    Default is `${com.sun.aas.instanceRoot}/logs/server.log`.
  `com.sun.enterprise.server.logging.GFFileHandler.flushFrequency`;;
    Default is `1`.
  `com.sun.enterprise.server.logging.GFFileHandler.formatter`;;
    Default is `com.sun.enterprise.server.logging.UniformLogFormatter`.
  `com.sun.enterprise.server.logging.GFFileHandler.logtoConsole`;;
    Default is `false`.
  `com.sun.enterprise.server.logging.GFFileHandler.maxHistoryFiles`;;
    Default is `0`.
  `com.sun.enterprise.server.logging.GFFileHandler.multiLineMode`;;
    Default is `true`.
  `com.sun.enterprise.server.logging.GFFileHandler.retainErrorsStasticsForHours`;;
    Default is `0`.
  `com.sun.enterprise.server.logging.GFFileHandler.rotationLimitInBytes`;;
    Default is `2000000`.
  `com.sun.enterprise.server.logging.GFFileHandler.rotationTimelimitInMinutes`;;
    Default is `0`.
  `com.sun.enterprise.server.logging.SyslogHandler.useSystemLogging`;;
    Default is `false`.
  `handlers`;;
    Default is `java.util.logging.ConsoleHandler`.
  `java.util.logging.ConsoleHandler.formatter`;;
    Default is `com.sun.enterprise.server.logging.UniformLogFormatter`.
  `java.util.logging.FileHandler.count`;;
    Default is `1`.
  `java.util.logging.FileHandler.formatter`;;
    Default is `java.util.logging.XMLFormatter`.
  `java.util.logging.FileHandler.limit`;;
    Default is `50000`.
  `java.util.logging.FileHandler.pattern`;;
    Default is `%h/java%u.log`.
  `log4j.logger.org.hibernate.validator.util.Version`;;
    Default is `warn`.

[[sthref2045]]

=== Examples

[[GSRFM748]][[sthref2046]]

==== Example 1   Setting the Maximum Number of Log History Files to Maintain

This example sets to 8 the maximum number of log history files for the
server as a whole.

[source]
----
asadmin> set-log-attributes --target=server \
com.sun.enterprise.server.logging.GFFileHandler.maxHistoryFiles=8
com.sun.enterprise.server.logging.GFFileHandler.maxHistoryFiles logging
attribute set with value 8.
These logging attributes are set for server.
Command set-log-attributes executed successfully.
----

[[sthref2047]]

=== Exit Status

0::
  subcommand executed successfully
1::
  error in executing the subcommand

[[sthref2048]]

=== See Also

link:asadmin.html#asadmin-1m[`asadmin`(1M)]

link:collect-log-files.html#collect-log-files-1[`collect-log-files`(1)],
link:list-log-attributes.html#list-log-attributes-1[`list-log-attributes`(1)],
link:list-log-levels.html#list-log-levels-1[`list-log-levels`(1)],
link:rotate-log.html#rotate-log-1[`rotate-log`(1)],
link:set-log-levels.html#set-log-levels-1[`set-log-levels`(1)]

"link:../administration-guide/logging.html#GSADG00010[Administering the Logging Service]" in GlassFish
Server Open Source Edition Administration Guide


