I don't know what you have in ID variable, so let me simplify it. Please let me know if the following correctly describes steps to reproduce your problem.
1. Create a new class with a static method containing a call of warning() method. Like this:
internal final class MyWarningTest
{
internal static void showMessage()
{
warning("Test message");
}
}
2. Create a new form, add a button, override its clicked() and call the previously defined method there.
3. Build the solution, run the form and press the button.
Result: The message isn't shown in infolog.
Please try it. I'm assuming you'll see the message, which would mean that you didn't give us correct information about your actual scenario.