Replies: 5 comments
-
Beta Was this translation helpful? Give feedback.
-
|
Response from ADK Answering Agent (experimental, answer may be inaccurate) TLDR: You can configure the log saving location yourself. ADK uses Python's standard Hi @hh54188, Thanks for your question and suggestion. The Agent Development Kit (ADK) uses Python's standard You can use import logging
logging.basicConfig(
filename='/path/to/your/desired/log/location/agent.log',
level=logging.INFO,
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s'
)
# Now you can proceed with your ADK application initialization
# ...By adding this to the beginning of your script, all subsequent logs from your application and the ADK will be written to the file you specified. You can choose any path where your user has write permissions. For more details on how to configure logging in ADK, you can refer to the official documentation. [1] Let me know if you have any other questions! [1] https://google.github.io/adk-docs/observability/logging/ |
Beta Was this translation helpful? Give feedback.
-
|
Response from ADK Answering Agent (experimental, answer may be inaccurate) TLDR: You can configure Python's standard Hi @hh54188, Thank you for your feedback. You are right that the default logging behavior can cause permission issues on certain systems. The ADK uses Python's standard This will direct all logs to a file named import logging
import os
# Create a logs directory if it doesn't exist
log_dir = 'logs'
if not os.path.exists(log_dir):
os.makedirs(log_dir)
logging.basicConfig(
level=logging.INFO,
format='%(asctime)s - %(levelname)s - %(name)s - %(message)s',
filename=os.path.join(log_dir, 'agent.log'), # Log to a file
filemode='a' # Append to the log file
)
# Your ADK agent code follows...This approach gives you full control over the log location, format, and rotation. Please let us know if you have any further questions. [1] https://google.github.io/adk-docs/observability/logging/ |
Beta Was this translation helpful? Give feedback.
-
|
Hi @adk-bot @hangfei , the answer provided by the AI doens't work, here are my sample code: from google.adk.agents.llm_agent import Agent
import logging
import os
log_location=os.path.join(os.path.dirname(__file__), 'custom_location.log')
logging.basicConfig(
filename=log_location
)
def get_project_creator() -> dict:
"""Returns the creator's information of the project."""
return {
"name": xxx",
}
root_agent = Agent(
model='gemini-2.5-flash',
name='creator_checker_agent',
description="Tells the creator's information of the project.",
instruction="You are a helpful assistant that tells the creator's information of the project. Use the 'get_project_creator' tool for this purpose.",
tools=[get_project_creator],
)I still got the same error: From the error message you can see the filename config doesn't work |
Beta Was this translation helpful? Give feedback.
-
|
Hi @hh54188 , as far as I understood the problem is not the path itself, but the privileges required to create symlinks. If you are not an admin, the only solution I have found is to go to file by this: Hope it helps. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Everytime when I try to run the ADK application I can only run it in the terminal which in admin mode, otherwise I will receive this error message:
It looks like because the ADK wants to save the log in the AppData folder by default? If we can add a new config to allow the developer to specify the log save location it would be better.
Thank you
Beta Was this translation helpful? Give feedback.
All reactions