or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

tessl/maven-org-springframework-boot--spring-boot-starter-logging

Starter for logging using Logback, providing default logging configuration for Spring Boot applications

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
mavenpkg:maven/org.springframework.boot/spring-boot-starter-logging@3.5.x

To install, run

npx @tessl/cli install tessl/maven-org-springframework-boot--spring-boot-starter-logging@3.5.0

0

# Spring Boot Starter Logging

1

2

Spring Boot Starter Logging provides the default logging configuration for Spring Boot applications. It serves as a dependency aggregator that includes Logback as the primary logging implementation along with bridges for Log4j and Java Util Logging compatibility, ensuring unified logging through the SLF4J facade.

3

4

## Package Information

5

6

- **Package Name**: org.springframework.boot:spring-boot-starter-logging

7

- **Package Type**: maven

8

- **Language**: Java

9

- **Installation**: Add to your `pom.xml`:

10

11

```xml

12

<dependency>

13

<groupId>org.springframework.boot</groupId>

14

<artifactId>spring-boot-starter-logging</artifactId>

15

<version>3.5.3</version>

16

</dependency>

17

```

18

19

Or in `build.gradle`:

20

21

```gradle

22

implementation 'org.springframework.boot:spring-boot-starter-logging:3.5.3'

23

```

24

25

## Core Imports

26

27

```java

28

import org.springframework.boot.logging.LoggingSystem;

29

import org.springframework.boot.logging.LogLevel;

30

import org.springframework.boot.logging.LoggerConfiguration;

31

import org.springframework.boot.logging.LoggerGroups;

32

import org.springframework.boot.logging.LoggerGroup;

33

import org.springframework.boot.logging.DeferredLog;

34

import org.springframework.boot.logging.DeferredLogs;

35

import org.springframework.boot.logging.CorrelationIdFormatter;

36

import org.springframework.boot.logging.logback.LogbackLoggingSystem;

37

import org.springframework.boot.logging.structured.StructuredLogFormatter;

38

import org.springframework.boot.logging.structured.CommonStructuredLogFormat;

39

```

40

41

## Basic Usage

42

43

```java

44

import org.springframework.boot.logging.LoggingSystem;

45

import org.springframework.boot.logging.LogLevel;

46

import org.springframework.boot.logging.LoggerGroups;

47

import org.springframework.boot.logging.DeferredLog;

48

49

// Get the current logging system

50

LoggingSystem loggingSystem = LoggingSystem.get(getClass().getClassLoader());

51

52

// Set log level for a specific logger

53

loggingSystem.setLogLevel("com.example.MyClass", LogLevel.DEBUG);

54

55

// Get logger configurations

56

List<LoggerConfiguration> configurations = loggingSystem.getLoggerConfigurations();

57

58

// Use logger groups for bulk configuration

59

LoggerGroups loggerGroups = new LoggerGroups();

60

loggerGroups.putAll(Map.of("web", List.of("org.springframework.web", "org.springframework.http")));

61

62

// Use deferred logging during startup

63

DeferredLog log = new DeferredLog();

64

log.info("Early startup message");

65

log.switchTo(MyComponent.class); // Switch to real logger later

66

```

67

68

## Architecture

69

70

Spring Boot Starter Logging is built around several key components:

71

72

- **Dependency Aggregation**: Bundles Logback Classic, Log4j-to-SLF4J bridge, and JUL-to-SLF4J bridge

73

- **Logging System Abstraction**: `LoggingSystem` provides a common interface over different logging implementations

74

- **Auto-Configuration**: Spring Boot automatically detects and configures the logging system on startup

75

- **Default Configuration**: Provides sensible defaults through XML configuration files in the classpath

76

- **Conversion Rules**: Custom Logback conversion rules for formatting log output

77

78

## Capabilities

79

80

### Logging System Management

81

82

Core abstraction for managing logging systems programmatically.

83

84

```java { .api }

85

/**

86

* Common abstraction over logging systems

87

*/

88

public abstract class LoggingSystem {

89

/**

90

* Detect and return the logging system in use

91

* @param classLoader class loader to use for detection

92

* @return the detected LoggingSystem

93

*/

94

public static LoggingSystem get(ClassLoader classLoader);

95

96

/**

97

* Reset logging system to limit output before full initialization

98

*/

99

public void beforeInitialize();

100

101

/**

102

* Fully initialize the logging system

103

* @param initializationContext the initialization context

104

* @param configLocation location of configuration file (may be null)

105

* @param logFile log file configuration

106

*/

107

public void initialize(LoggingInitializationContext initializationContext,

108

String configLocation, LogFile logFile);

109

110

/**

111

* Set the logging level for a specific logger

112

* @param loggerName name of the logger

113

* @param level the level to set

114

*/

115

public void setLogLevel(String loggerName, LogLevel level);

116

117

/**

118

* Get current logger configurations

119

* @return list of logger configurations

120

*/

121

public List<LoggerConfiguration> getLoggerConfigurations();

122

123

/**

124

* Get configuration for a specific logger

125

* @param loggerName name of the logger

126

* @return logger configuration or null if not found

127

*/

128

public LoggerConfiguration getLoggerConfiguration(String loggerName);

129

130

/**

131

* Get supported log levels for this logging system

132

* @return set of supported log levels

133

*/

134

public Set<LogLevel> getSupportedLogLevels();

135

136

/**

137

* Get logging system properties

138

* @param environment the environment

139

* @return logging system properties

140

*/

141

public LoggingSystemProperties getSystemProperties(ConfigurableEnvironment environment);

142

143

/**

144

* Clean up the logging system

145

*/

146

public void cleanUp();

147

148

/**

149

* Get a runnable for shutdown handling

150

* @return shutdown handler runnable

151

*/

152

public Runnable getShutdownHandler();

153

}

154

```

155

156

### Logback Logging System

157

158

Logback-specific implementation of the logging system.

159

160

```java { .api }

161

/**

162

* LoggingSystem implementation for Logback

163

*/

164

public class LogbackLoggingSystem extends AbstractLoggingSystem {

165

// Inherits all methods from LoggingSystem with Logback-specific implementations

166

}

167

```

168

169

### Log Level Management

170

171

Enumeration of supported logging levels.

172

173

```java { .api }

174

/**

175

* Logging levels supported by a LoggingSystem

176

*/

177

public enum LogLevel {

178

TRACE, DEBUG, INFO, WARN, ERROR, FATAL, OFF;

179

180

/**

181

* Log message at this level

182

* @param logger the logger to use

183

* @param message the message to log

184

*/

185

public void log(Log logger, Object message);

186

187

/**

188

* Log message with cause at this level

189

* @param logger the logger to use

190

* @param message the message to log

191

* @param cause the throwable cause

192

*/

193

public void log(Log logger, Object message, Throwable cause);

194

}

195

```

196

197

### Logger Groups

198

199

Manage multiple loggers as a group for efficient level configuration.

200

201

```java { .api }

202

/**

203

* A collection of loggers that can be configured together

204

*/

205

public class LoggerGroups implements Iterable<LoggerGroup> {

206

/**

207

* Create an empty LoggerGroups

208

*/

209

public LoggerGroups();

210

211

/**

212

* Create LoggerGroups with initial groups

213

* @param namesAndMembers map of group names to member logger names

214

*/

215

public LoggerGroups(Map<String, List<String>> namesAndMembers);

216

217

/**

218

* Add all groups from a map

219

* @param namesAndMembers map of group names to member logger names

220

*/

221

public void putAll(Map<String, List<String>> namesAndMembers);

222

223

/**

224

* Get a logger group by name

225

* @param name the group name

226

* @return the logger group or null if not found

227

*/

228

public LoggerGroup get(String name);

229

230

/**

231

* Iterate over all logger groups

232

* @return iterator for logger groups

233

*/

234

public Iterator<LoggerGroup> iterator();

235

}

236

237

/**

238

* A group of loggers that can be configured together

239

*/

240

public class LoggerGroup {

241

/**

242

* Get the group name

243

* @return group name

244

*/

245

public String getName();

246

247

/**

248

* Get the member logger names

249

* @return list of logger names in this group

250

*/

251

public List<String> getMembers();

252

253

/**

254

* Check if this group has any members

255

* @return true if the group has members

256

*/

257

public boolean hasMembers();

258

259

/**

260

* Get the configured log level for this group

261

* @return configured log level or null if not set

262

*/

263

public LogLevel getConfiguredLevel();

264

265

/**

266

* Configure log level for all members of this group

267

* @param level the level to set

268

* @param configurer function to configure each member logger

269

*/

270

public void configureLogLevel(LogLevel level, BiConsumer<String, LogLevel> configurer);

271

}

272

```

273

274

### Deferred Logging

275

276

Support for logging before the logging system is fully initialized.

277

278

```java { .api }

279

/**

280

* A Log implementation that can hold log events until initialization

281

*/

282

public class DeferredLog implements Log {

283

/**

284

* Create a new deferred log

285

*/

286

public DeferredLog();

287

288

// All standard Log interface methods

289

public boolean isTraceEnabled();

290

public boolean isDebugEnabled();

291

public boolean isInfoEnabled();

292

public boolean isWarnEnabled();

293

public boolean isErrorEnabled();

294

public boolean isFatalEnabled();

295

296

public void trace(Object message);

297

public void trace(Object message, Throwable t);

298

public void debug(Object message);

299

public void debug(Object message, Throwable t);

300

public void info(Object message);

301

public void info(Object message, Throwable t);

302

public void warn(Object message);

303

public void warn(Object message, Throwable t);

304

public void error(Object message);

305

public void error(Object message, Throwable t);

306

public void fatal(Object message);

307

public void fatal(Object message, Throwable t);

308

309

/**

310

* Switch deferred log to use a specific destination logger

311

* @param destination the destination logger class

312

*/

313

public void switchTo(Class<?> destination);

314

}

315

316

/**

317

* Factory for creating deferred logs

318

*/

319

public interface DeferredLogFactory {

320

/**

321

* Get a deferred log for a class destination

322

* @param destination the destination class

323

* @return deferred log instance

324

*/

325

Log getLog(Class<?> destination);

326

327

/**

328

* Get a deferred log for a log destination

329

* @param destination the destination log

330

* @return deferred log instance

331

*/

332

Log getLog(Log destination);

333

334

/**

335

* Get a deferred log for a supplier destination

336

* @param destination the destination supplier

337

* @return deferred log instance

338

*/

339

Log getLog(Supplier<Log> destination);

340

}

341

342

/**

343

* Collection of deferred logs that can be switched over together

344

*/

345

public class DeferredLogs {

346

/**

347

* Get a deferred log for a specific destination

348

* @param destination the destination class

349

* @return deferred log instance

350

*/

351

public DeferredLog getLog(Class<?> destination);

352

353

/**

354

* Switch all deferred logs to their final destinations

355

*/

356

public void switchOverAll();

357

}

358

```

359

360

### Correlation ID Support

361

362

Support for correlation IDs in log formatting for request tracing.

363

364

```java { .api }

365

/**

366

* Formatter for correlation IDs following W3C trace context specification

367

*/

368

public class CorrelationIdFormatter {

369

/**

370

* Default correlation ID formatter instance

371

*/

372

public static final CorrelationIdFormatter DEFAULT;

373

374

/**

375

* Format correlation ID using the provided resolver

376

* @param resolver function to resolve correlation values

377

* @return formatted correlation ID string

378

*/

379

public String format(UnaryOperator<String> resolver);

380

381

/**

382

* Format correlation ID to an appendable

383

* @param resolver function to resolve correlation values

384

* @param appendable target to append to

385

* @throws IOException if appending fails

386

*/

387

public void formatTo(UnaryOperator<String> resolver, Appendable appendable) throws IOException;

388

389

/**

390

* Create formatter from specification string

391

* @param spec the correlation specification

392

* @return correlation ID formatter

393

*/

394

public static CorrelationIdFormatter of(String spec);

395

396

/**

397

* Create formatter from specification array

398

* @param spec the correlation specification array

399

* @return correlation ID formatter

400

*/

401

public static CorrelationIdFormatter of(String[] spec);

402

403

/**

404

* Create formatter from specification collection

405

* @param spec the correlation specification collection

406

* @return correlation ID formatter

407

*/

408

public static CorrelationIdFormatter of(Collection<String> spec);

409

}

410

```

411

412

### Structured Logging Support

413

414

Support for structured log formats like Elastic Common Schema, Graylog, and Logstash.

415

416

```java { .api }

417

/**

418

* Interface for formatting log events into structured formats

419

* @param <E> the log event type

420

*/

421

public interface StructuredLogFormatter<E> {

422

/**

423

* Format a log event as a string

424

* @param event the log event

425

* @return formatted string

426

*/

427

String format(E event);

428

429

/**

430

* Format a log event as bytes

431

* @param event the log event

432

* @param charset the character set to use

433

* @return formatted bytes

434

*/

435

byte[] formatAsBytes(E event, Charset charset);

436

}

437

438

/**

439

* Common structured log formats supported by Spring Boot

440

*/

441

public enum CommonStructuredLogFormat {

442

/**

443

* Elastic Common Schema format

444

*/

445

ELASTIC_COMMON_SCHEMA,

446

447

/**

448

* Graylog Extended Log Format

449

*/

450

GRAYLOG_EXTENDED_LOG_FORMAT,

451

452

/**

453

* Logstash JSON format

454

*/

455

LOGSTASH

456

}

457

458

/**

459

* Factory for creating structured log formatters

460

*/

461

public class StructuredLogFormatterFactory {

462

// Factory methods for creating structured formatters

463

// Implementation varies by logging system

464

}

465

466

/**

467

* Manages context key-value pairs for structured logging

468

*/

469

public class ContextPairs {

470

// Methods for managing structured logging context

471

// Implementation provides key-value pair management

472

}

473

```

474

475

### Stack Trace Printing

476

477

Customizable stack trace formatting for log output.

478

479

```java { .api }

480

/**

481

* Interface for formatting stack traces

482

*/

483

public interface StackTracePrinter {

484

/**

485

* Print stack trace to a string

486

* @param throwable the throwable to print

487

* @return stack trace as string

488

*/

489

String printStackTraceToString(Throwable throwable);

490

491

/**

492

* Print stack trace to an appendable

493

* @param throwable the throwable to print

494

* @param out the target appendable

495

* @throws IOException if writing fails

496

*/

497

void printStackTrace(Throwable throwable, Appendable out) throws IOException;

498

}

499

500

/**

501

* Standard implementation of stack trace printer

502

*/

503

public class StandardStackTracePrinter implements StackTracePrinter {

504

/**

505

* Create a standard stack trace printer

506

*/

507

public StandardStackTracePrinter();

508

509

// Implements StackTracePrinter methods with standard formatting

510

}

511

```

512

513

### Logger Configuration

514

515

Immutable representation of logger configuration.

516

517

```java { .api }

518

/**

519

* Immutable class representing logger configuration

520

*/

521

public final class LoggerConfiguration {

522

/**

523

* Get the logger name

524

* @return logger name

525

*/

526

public String getName();

527

528

/**

529

* Get the configured level (may be null if inherited)

530

* @return configured level

531

*/

532

public LogLevel getConfiguredLevel();

533

534

/**

535

* Get the effective level (resolved through inheritance)

536

* @return effective level

537

*/

538

public LogLevel getEffectiveLevel();

539

540

/**

541

* Get level configuration considering inheritance

542

* @return level configuration

543

*/

544

public LevelConfiguration getLevelConfiguration();

545

546

/**

547

* Get level configuration for specific scope

548

* @param scope the configuration scope

549

* @return level configuration for the scope

550

*/

551

public LevelConfiguration getLevelConfiguration(ConfigurationScope scope);

552

}

553

```

554

555

### Log File Configuration

556

557

Configuration for log file settings.

558

559

```java { .api }

560

/**

561

* Represents a log file configuration

562

*/

563

public class LogFile {

564

// File-based logging configuration methods

565

}

566

```

567

568

### Logging Initialization Context

569

570

Context used during logging system initialization.

571

572

```java { .api }

573

/**

574

* Context used during logging system initialization

575

*/

576

public class LoggingInitializationContext {

577

// Initialization context methods

578

}

579

```

580

581

### Logging System Properties

582

583

Properties that should be applied to the logging system.

584

585

```java { .api }

586

/**

587

* Properties that should be applied to the logging system

588

*/

589

public class LoggingSystemProperties {

590

// System properties methods

591

}

592

593

/**

594

* Logback-specific system properties

595

*/

596

public class LogbackLoggingSystemProperties extends LoggingSystemProperties {

597

// Logback-specific properties

598

}

599

```

600

601

## Configuration Properties

602

603

### System Properties

604

605

```java { .api }

606

public static final String SYSTEM_PROPERTY = "org.springframework.boot.logging.LoggingSystem";

607

public static final String NONE = "none";

608

public static final String ROOT_LOGGER_NAME = "ROOT";

609

public static final String EXPECT_CORRELATION_ID_PROPERTY = "logging.expect-correlation-id";

610

```

611

612

### Logging System Properties

613

614

The following system properties are available for logging configuration:

615

616

```java { .api }

617

/**

618

* System properties that can be configured for logging

619

*/

620

public enum LoggingSystemProperty {

621

APPLICATION_NAME("logging.application-name"),

622

APPLICATION_GROUP("logging.application-group"), // New in Spring Boot 3.4+

623

PID("logging.pid"),

624

LOG_FILE("logging.file.name"),

625

LOG_PATH("logging.file.path"),

626

CONSOLE_CHARSET("logging.charset.console"),

627

FILE_CHARSET("logging.charset.file"),

628

CONSOLE_THRESHOLD("logging.threshold.console"),

629

FILE_THRESHOLD("logging.threshold.file"),

630

EXCEPTION_CONVERSION_WORD("logging.exception-conversion-word"),

631

CONSOLE_PATTERN("logging.pattern.console"),

632

FILE_PATTERN("logging.pattern.file"),

633

CONSOLE_STRUCTURED_FORMAT("logging.structured.format.console"), // New in Spring Boot 3.4+

634

FILE_STRUCTURED_FORMAT("logging.structured.format.file"), // New in Spring Boot 3.4+

635

LEVEL_PATTERN("logging.pattern.level"),

636

DATEFORMAT_PATTERN("logging.pattern.dateformat"),

637

CORRELATION_PATTERN("logging.pattern.correlation");

638

639

/**

640

* Get the environment variable name for this property

641

* @return environment variable name

642

*/

643

public String getEnvironmentVariableName();

644

645

/**

646

* Get the application property name for this property

647

* @return application property name

648

*/

649

public String getApplicationPropertyName();

650

}

651

```

652

653

### Logback Configuration Properties

654

655

The following properties can be configured in `application.properties` or `application.yml`:

656

657

- `logging.application-name` - Application name for log formatting

658

- `logging.application-group` - Application group for log formatting (Spring Boot 3.4+)

659

- `logging.charset.console` - Console log charset (default: UTF-8)

660

- `logging.charset.file` - File log charset (default: UTF-8)

661

- `logging.threshold.console` - Console log threshold level

662

- `logging.threshold.file` - File log threshold level

663

- `logging.pattern.console` - Console log pattern format

664

- `logging.pattern.file` - File log pattern format

665

- `logging.pattern.level` - Log level pattern format

666

- `logging.pattern.dateformat` - Date format pattern

667

- `logging.pattern.correlation` - Correlation ID pattern format

668

- `logging.structured.format.console` - Console structured format (Spring Boot 3.4+)

669

- `logging.structured.format.file` - File structured format (Spring Boot 3.4+)

670

- `logging.exception-conversion-word` - Exception conversion word

671

672

### Custom Conversion Rules

673

674

Logback custom conversion rules provided by default configuration:

675

676

- `applicationName` - Application name converter

677

- `clr` - Color converter for console output

678

- `correlationId` - Correlation ID converter for request tracing

679

- `esb` - Enclosed in square brackets converter

680

- `wex` - Whitespace throwable proxy converter

681

- `wEx` - Extended whitespace throwable proxy converter

682

683

## Default Configuration Files

684

685

The starter includes several default Logback configuration files:

686

687

- `defaults.xml` - Default configuration with conversion rules and properties

688

- `base.xml` - Base configuration including defaults, console and file appenders

689

- `console-appender.xml` - Console appender configuration

690

- `file-appender.xml` - File appender configuration

691

- `structured-console-appender.xml` - Structured console appender

692

- `structured-file-appender.xml` - Structured file appender

693

694

## Dependencies Provided

695

696

This starter automatically includes the following dependencies:

697

698

- **ch.qos.logback:logback-classic** - Main Logback logging implementation

699

- **org.apache.logging.log4j:log4j-to-slf4j** - Bridge for Log4j 1.x to SLF4J

700

- **org.slf4j:jul-to-slf4j** - Bridge for Java Util Logging to SLF4J

701

702

## Standard Configuration File Lookup Order

703

704

Logback looks for configuration files in the following order:

705

706

1. `logback-test.groovy`

707

2. `logback-test.xml`

708

3. `logback.groovy`

709

4. `logback.xml`

710

711

If none are found, Spring Boot's default configuration is applied.

712

713

### Factory Classes

714

715

Factory interfaces for creating and discovering logging systems.

716

717

```java { .api }

718

/**

719

* Factory interface for creating LoggingSystem instances

720

*/

721

public interface LoggingSystemFactory {

722

/**

723

* Get a logging system for the specified class loader

724

* @param classLoader the class loader to use

725

* @return the logging system

726

*/

727

LoggingSystem getLoggingSystem(ClassLoader classLoader);

728

729

/**

730

* Create a factory from Spring Boot's spring.factories mechanism

731

* @return logging system factory

732

*/

733

static LoggingSystemFactory fromSpringFactories();

734

}

735

736

/**

737

* Delegating factory that tries multiple logging system factories

738

*/

739

public class DelegatingLoggingSystemFactory implements LoggingSystemFactory {

740

/**

741

* Create a delegating factory with the given delegate factories

742

* @param delegates the delegate factories

743

*/

744

public DelegatingLoggingSystemFactory(List<LoggingSystemFactory> delegates);

745

746

/**

747

* Get a logging system using the delegate factories

748

* @param classLoader the class loader

749

* @return the logging system

750

*/

751

public LoggingSystem getLoggingSystem(ClassLoader classLoader);

752

}

753

```

754

755

## Usage Examples

756

757

### Logger Groups Example

758

759

```java

760

import org.springframework.boot.logging.LoggerGroups;

761

import org.springframework.boot.logging.LoggerGroup;

762

import org.springframework.boot.logging.LogLevel;

763

764

// Create logger groups for web and security components

765

Map<String, List<String>> groups = Map.of(

766

"web", List.of("org.springframework.web", "org.springframework.http"),

767

"security", List.of("org.springframework.security", "org.springframework.boot.autoconfigure.security")

768

);

769

770

LoggerGroups loggerGroups = new LoggerGroups(groups);

771

772

// Configure log level for entire web group

773

LoggerGroup webGroup = loggerGroups.get("web");

774

if (webGroup != null) {

775

webGroup.configureLogLevel(LogLevel.DEBUG, (loggerName, level) -> {

776

LoggingSystem.get(getClass().getClassLoader()).setLogLevel(loggerName, level);

777

});

778

}

779

```

780

781

### Deferred Logging Example

782

783

```java

784

import org.springframework.boot.logging.DeferredLog;

785

import org.springframework.boot.logging.DeferredLogs;

786

787

// Create deferred logs for early startup logging

788

DeferredLogs deferredLogs = new DeferredLogs();

789

DeferredLog log = deferredLogs.getLog(MyStartupComponent.class);

790

791

// Log during early startup (before logging system is ready)

792

log.info("Starting up component...");

793

log.debug("Configuration loaded: {}", config);

794

795

// Later, switch all deferred logs to their final destinations

796

deferredLogs.switchOverAll();

797

```

798

799

### Correlation ID Example

800

801

```java

802

import org.springframework.boot.logging.CorrelationIdFormatter;

803

804

// Create custom correlation formatter

805

CorrelationIdFormatter formatter = CorrelationIdFormatter.of("traceId={traceId},spanId={spanId}");

806

807

// Use in log formatting

808

String correlationId = formatter.format(key -> {

809

if ("traceId".equals(key)) return getCurrentTraceId();

810

if ("spanId".equals(key)) return getCurrentSpanId();

811

return null;

812

});

813

```

814

815

### Structured Logging Example

816

817

```java

818

import org.springframework.boot.logging.structured.CommonStructuredLogFormat;

819

import org.springframework.boot.logging.structured.StructuredLogFormatter;

820

821

// Configure for Elastic Common Schema

822

# application.properties

823

logging.structured.format.file=elastic-common-schema

824

825

// Or configure for Logstash format

826

logging.structured.format.console=logstash

827

```

828

829

## Error Handling

830

831

The logging system may throw the following exceptions:

832

833

- `IllegalStateException` - When logging system cannot be initialized

834

- `IllegalArgumentException` - When invalid log level or logger name is provided

835

- `UnsupportedOperationException` - Thrown by default implementations of `setLogLevel()`, `getLoggerConfigurations()`, and `getLoggerConfiguration()` when not implemented by specific logging system

836

- `IOException` - When correlation ID formatting to appendable fails

837

838

## Types

839

840

```java { .api }

841

/**

842

* Configuration scope for logger level configuration

843

*/

844

public enum ConfigurationScope {

845

DIRECT, INHERITED

846

}

847

848

/**

849

* Level configuration details

850

*/

851

public static class LevelConfiguration {

852

/**

853

* Create level configuration for a standard log level

854

* @param level the log level

855

* @return level configuration

856

*/

857

public static LevelConfiguration of(LogLevel level);

858

859

/**

860

* Create level configuration for a custom level

861

* @param levelName the custom level name

862

* @return level configuration

863

*/

864

public static LevelConfiguration ofCustom(String levelName);

865

866

/**

867

* Check if this is a custom level configuration

868

* @return true if custom level

869

*/

870

public boolean isCustom();

871

872

/**

873

* Get the name of the level

874

* @return level name

875

*/

876

public String getName();

877

}

878

```