> **logs-java** — chapter 153 of 200 in [PostHog/skills](https://skillsdocs.com/PostHog/skills).
>
> Book (all chapters, one file): https://skillsdocs.com/PostHog/skills.md
> Machine manifest: https://skillsdocs.com/PostHog/skills/.well-known/agent-skills/index.json
> Install the book: `npx skills add PostHog/skills`
> Upstream: https://github.com/PostHog/skills/blob/main/skills/posthog/all/skills/logs-java/SKILL.md @ `main`
> Raw bytes, no header: https://raw.githubusercontent.com/PostHog/skills/main/skills/posthog/all/skills/logs-java/SKILL.md
> Base for relative paths: https://raw.githubusercontent.com/PostHog/skills/main/skills/posthog/all/skills/logs-java/
> Licence: MIT — https://spdx.org/licenses/MIT.html
>
> Bundled files (7), referenced from this skill's directory:
>   - `references/best-practices.md` — https://raw.githubusercontent.com/PostHog/skills/main/skills/posthog/all/skills/logs-java/references/best-practices.md
>   - `references/debug-logs-mcp.md` — https://raw.githubusercontent.com/PostHog/skills/main/skills/posthog/all/skills/logs-java/references/debug-logs-mcp.md
>   - `references/java.md` — https://raw.githubusercontent.com/PostHog/skills/main/skills/posthog/all/skills/logs-java/references/java.md
>   - `references/link-session-replay.md` — https://raw.githubusercontent.com/PostHog/skills/main/skills/posthog/all/skills/logs-java/references/link-session-replay.md
>   - `references/search.md` — https://raw.githubusercontent.com/PostHog/skills/main/skills/posthog/all/skills/logs-java/references/search.md
>   - `references/start-here.md` — https://raw.githubusercontent.com/PostHog/skills/main/skills/posthog/all/skills/logs-java/references/start-here.md
>   - `references/troubleshooting.md` — https://raw.githubusercontent.com/PostHog/skills/main/skills/posthog/all/skills/logs-java/references/troubleshooting.md
>
> Content © its authors, served unmodified. Takedown: https://github.com/kyleledbetter/skillsdocs/issues/new?labels=takedown&title=Takedown+request

<!-- Verbatim upstream SKILL.md follows, YAML frontmatter included. -->

---
name: logs-java
description: PostHog logs for Java
metadata:
  author: PostHog
  version: 1.9.4
---

# PostHog logs for Java

This skill helps you add PostHog log ingestion to Java applications.

## Reference files

- `references/java.md` - Java logs installation - docs
- `references/start-here.md` - Getting started with logs - docs
- `references/search.md` - Search logs - docs
- `references/best-practices.md` - Logging best practices - docs
- `references/troubleshooting.md` - Logs troubleshooting - docs
- `references/link-session-replay.md` - Link session replay - docs
- `references/debug-logs-mcp.md` - Debug logs with mcp - docs

Consult the documentation for API details and framework-specific patterns.

## Key principles

- **Environment variables**: Always use environment variables for PostHog keys and OpenTelemetry endpoints. Never hardcode them.
- **Minimal changes**: Add log export alongside existing logging. Don't replace or restructure existing logging code.
- **OpenTelemetry**: PostHog logs use the OpenTelemetry protocol. Configure an OTLP exporter pointed at PostHog's ingest endpoint.
- **Structured logging**: Prefer structured log formats with key-value properties over plain text messages.

## Framework guidelines

_No specific framework guidelines._
