Enterprise Library logging offers a bunch of bits to twiddle. So, before getting into changing the configuration maybe some of the out of the box settings can let you do what you want?
It sounds to me like you want your application to log some messages during startup and then not to log any more messages. I'm assuming that you explicitly know when you are done logging startup messages.
If the above is true I think the easiest way would be to use the LogEntry Priority property.
In the configuration file setup a Priority Filter with a minimum priority of 2:
<logFilters>
<add minimumPriority="2" maximumPriority="2147483647" type="Microsoft.Practices.EnterpriseLibrary.Logging.Filters.PriorityFilter, Microsoft.Practices.EnterpriseLibrary.Logging, Version=4.1.0.0, Culture=neutral, PublicKeyToken=null"
name="Priority" />
<add enabled="true" type="Microsoft.Practices.EnterpriseLibrary.Logging.Filters.LogEnabledFilter, Microsoft.Practices.EnterpriseLibrary.Logging, Version=4.1.0.0, Culture=neutral, PublicKeyToken=null"
name="LogEnabled Filter" />
</logFilters>
Then during startup use a priority of 2 (or greater) to log your messages. Then when you know you are done set the priority down to 1.
I would encapsulate it better but a code sample would look like:
public class MyApp
{
public static int LogPriority = 2;
public static readonly string MyAppCategory = "MyAppCategory";
static void Main()
{
Logger.Write("Loading 1...", MyAppCategory, LogPriority);
// ...
Logger.Write("Loading 2...", MyAppCategory, LogPriority);
// Done loading so turn off logging
LogPriority = 1;
Logger.Write("Message not logged", MyAppCategory, LogPriority);
}
}
Now if you ever want to turn on logging for the rest of your app, just lower the priority filter from 2 to 1 and everything will get logged.