Xiaomi Galaxy Talos Book

Configuration Properties


Using SDK requires configuring Properties. Talos provides two ways for users to configure:

  • The user adds a configuration file to the classpath, writes the configuration to the file as a key-value, and passes the file name to the corresponding SDK interface

  • The user constructs a Properties instance in the program and sets each configuration item in the instance; this method is not recommended, and the user is recommended to use the configuration file;

Using configuration files

Taking TalosProducer as an example, assume that a file whose name is "talos.properties" is constructed as follows:

  galaxy.talos.service.endpoint=https://talos.api.xiaomi.com
  galaxy.talos.client.is.auto.location=false

The code for constructing TalosProducerConfig is as follows:

  TalosProducerConfig producerConfig = new TalosProducerConfig("talos.properties")

Control log output

If the user wants to control the log output, he can add a log4j.properties to the claspath or put this file in the resources folder of the project program. The configuration items can be referred to as follows:

  log4j.rootLogger=INFO, stdout, logfile

  log4j.category.com.xiaomi.infra.galaxy.talos=INFO

  log4j.appender.logfile=org.apache.log4j.FileAppender
  log4j.appender.logfile.File=log/$your_log_file_name.log
  log4j.appender.logfile.Append=true
  log4j.appender.logfile.layout=org.apache.log4j.PatternLayout
  log4j.appender.logfile.layout.ConversionPattern=%d %p [%t] [%c] - %m%n