Why is the logger being deactivated when the APDL solver is triggered?

Member Posts: 80
10 Comments 5 Likes First Answer First Anniversary
**

Hi Team,

I was working with the logging module, and I've noticed that when the analysis is running, the logger disconnects. Once the solving process is complete, it automatically reconnects.

Is there any solution to handle this issue?

Welcome!

It looks like you're new here. Sign in or register to get started.

Comments

  • Member, Employee, GitHub-issue-creator Posts: 353
    50 Answers 100 Comments Second Anniversary 25 Likes
    ✭✭✭✭

    Hi @Naveen Kumar Begari Could you please provide a simple code example to demonstrate this issue?

  • Member Posts: 80
    10 Comments 5 Likes First Answer First Anniversary
    **

    Hello @Landon Mitchell Kanner , I have sent the script internally

  • Member Posts: 80
    10 Comments 5 Likes First Answer First Anniversary
    **
    edited February 7
    1. async def solve_structural_analysis():
    2. try:
    3. logger.debug("Solving Structural Analysis...")
    4. asyncio.to_thread(solution.Solve(True))
    5. logger.debug("Solved Structural Analysis...")
    6. except Exception as e:
    7. logger.error(f"An error occurred while solving the analysis: {e}")
    8. # Running the async function
    9. asyncio.run(solve_structural_analysis())

    Here is the script, "The logger shows nothing during the analysis, and only starts logging again once the solution process is complete.

    @James Derrick It would be very helpful for your guidance

    Thanks
    Naveen Kumar

  • Member Posts: 80
    10 Comments 5 Likes First Answer First Anniversary
    **

    Please consider this script: @AKD-Scripting-Team

    1. async def solve_structural_analysis():
    2. try:
    3. logger.debug("Solving Structural Analysis...")
    4. asyncio.to_thread(solution.Solve(True))
    5. logger.debug("Solved Structural Analysis...")
    6. except Exception as e:
    7. logger.error(f"An error occurred while solving the analysis: {e}")
    8.  
    9. #Running the async function
    10. asyncio.run(solve_structural_analysis())
  • Member, Employee, GitHub-issue-creator Posts: 353
    50 Answers 100 Comments Second Anniversary 25 Likes
    ✭✭✭✭

    @Ayush Kumar have you seen this issue before?

  • Member, Moderator, Employee Posts: 479
    100 Answers 250 Likes 100 Comments Second Anniversary
    ✭✭✭✭

    @Naveen Kumar Begari can you please share the import modules on the top of your script? And which Mechanical version are you working with?

  • Member Posts: 80
    10 Comments 5 Likes First Answer First Anniversary
    **

    Hi @Ayush Kumar ,
    For above code I used below modules:

    from ansys.mechanical.core import App
    import logging

    And now im checking with - from ansys.mechanical.core.embedding.logger import Logger,Configuration

Welcome!

It looks like you're new here. Sign in or register to get started.