Skip to content

Commit 2f931da

Browse files
Adding details to README
1 parent 8cc2047 commit 2f931da

3 files changed

Lines changed: 57 additions & 8 deletions

File tree

README.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ Table of Contents
1212
- [Format](#format)
1313
- [Modes](#modes)
1414
- [The LLM (Claude) config file](#the-llm-claude-config-file)
15+
- [Logging](#logging)
16+
- [Log File Locations](#log-file-locations)
17+
- [Log Features](#log-features)
18+
- [Enabling File Logging](#enabling-file-logging)
1519
- [Further Documentation](#further-documentation)
1620
- [Additional Information](#additional-information)
1721

@@ -227,6 +231,47 @@ And then add this section
227231

228232
This will pickup the default location of MCP server config file. It can also be passed in the `args` section above as `"--config-file", "<custom config file>"` after `run`
229233

234+
# Logging
235+
236+
The Dremio MCP server automatically writes log files to platform-specific directories following operating system conventions. This helps with troubleshooting and monitoring the server's operation.
237+
238+
## Log File Locations
239+
240+
The log files are stored in the following locations based on your operating system:
241+
242+
### Linux
243+
- **Directory**: `~/.local/share/dremioai/logs/`
244+
- **Full path**: `~/.local/share/dremioai/logs/dremioai.log`
245+
- **XDG compliance**: Respects `$XDG_DATA_HOME` environment variable if set
246+
247+
### macOS
248+
- **Directory**: `~/Library/Logs/dremioai/`
249+
- **Full path**: `~/Library/Logs/dremioai/dremioai.log`
250+
251+
### Windows
252+
- **Directory**: `%LOCALAPPDATA%\dremioai\logs\`
253+
- **Full path**: `%LOCALAPPDATA%\dremioai\logs\dremioai.log`
254+
- **Typical location**: `C:\Users\<username>\AppData\Local\dremioai\logs\dremioai.log`
255+
256+
257+
## Controlling File Logging
258+
259+
By default, the MCP server logs to the logfile mentioned above. To control it further, you can use the following environment variables and command line options:
260+
261+
1. **Use JSON format**: `JSON_LOGGING=1` or pass `--enable-json-logging` for structured JSON logs
262+
2. **Disable file logging**: pass `--no-log-to-file` to disable writing logs to file
263+
264+
Example:
265+
```shell
266+
$ uv run dremio-mcp-server run --no-log-to-file --enable-json-logging
267+
268+
# OR
269+
270+
$ uv run dremio-mcp-server run --enable-json-logging
271+
```
272+
273+
The log directory is automatically created if it doesn't exist, so no manual setup is required.
274+
230275
# Further Documentation
231276

232277
1. [Architecture](docs/architecture.md): Detailed overview of the Dremio MCP server architecture, including component interactions and data flows.

src/dremioai/log.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@ def get_log_directory(app_name: str = "dremioai") -> Path:
4646
return base_dir
4747

4848

49+
def get_log_file() -> Path:
50+
return get_log_directory() / "dremioai.log"
51+
52+
4953
def logger(name=None):
5054
if not structlog.is_configured():
5155
configure()
@@ -82,8 +86,7 @@ def configure(enable_json_logging=None, to_file=False):
8286

8387
# Set up file logging if requested
8488
if to_file:
85-
log_dir = get_log_directory()
86-
log_file_path = log_dir / "dremioai.log"
89+
log_file_path = get_log_file()
8790

8891
# Configure rotating file handler
8992
file_handler = RotatingFileHandler(

src/dremioai/servers/mcp.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -105,13 +105,13 @@ def main(
105105
list_tools: Annotated[
106106
bool, Option(help="List available tools for this mode and exit")
107107
] = False,
108-
log_to_file: Annotated[Optional[bool], Option(help="Log to file")] = False,
108+
log_to_file: Annotated[Optional[bool], Option(help="Log to file")] = True,
109+
enable_json_logging: Annotated[
110+
Optional[bool], Option(help="Enable JSON logs")
111+
] = False,
109112
):
110-
if not list_tools:
111-
log.configure(enable_json_logging=True, to_file=True)
112-
else:
113-
log.configure(enable_json_logging=True, to_file=log_to_file)
114-
log.set_level("DEBUG")
113+
log.configure(enable_json_logging=enable_json_logging, to_file=log_to_file)
114+
log.set_level("DEBUG")
115115

116116
if mode is not None:
117117
mode = [tools.ToolType[m.upper()] for m in mode]
@@ -205,6 +205,7 @@ def show_default_config(
205205
)
206206
)
207207
)
208+
pp(f"Default log file: {log.get_log_file()!s}")
208209
case ConfigTypes.claude:
209210
cc = get_claude_config_path()
210211
pp(f"Default config file: '{cc!s}' (exists = {cc.exists()!s})")

0 commit comments

Comments
 (0)