This is an old thread but I came accross the same issue with the framework and thought I'd log my solution here in case it helps anyone else.
Below is my revised code for the LogTaskPreExecute stored procedure.
We've put all our logging tables and stored procedures in a schema named logging so others will need to convert this back to wherever their stuff is stored.
What the changes do:
1) Explicitly excludes the tasks 'SQL LogTaskPreExecute' and 'SQL LogTaskPostExecute' so the child package's use of these doesn't appear in the parent package's task log
2) When a task is started the procedure checks to see if any other package in the batch created after the current package (i.e. a child package) has logged a task with the same source ID in the last half second. If there is then it doesn't log the task.
This works for us although comes with the warning that potentially it could fail to log valid tasks in some circumstances (e.g. if the parent package needed to call the same child package twice at the same time for some reason).
Code:
CREATE PROCEDURE [logging].[LogTaskPreExecute]
( @PackageLogID int
,@SourceName varchar(64)
,@SourceID uniqueidentifier
,@PackageID uniqueidentifier
)
AS
BEGIN
SET NOCOUNT ON
IF @PackageID <> @SourceID
AND @SourceName <> 'SQL LogPackageStart'
AND @SourceName <> 'SQL LogPackageEnd'
AND @SourceName <> 'SQL LogTaskPreExecute'
AND @SourceName <> 'SQL LogTaskPostExecute'
AND NOT EXISTS
(SELECT 1
FROM
logging.PackageTaskLog
WHERE
SourceID = @SourceID
AND StartDateTime > dateadd(millisecond,-500,getdate())
AND PackageLogID IN (SELECT PackageLogID
FROM
logging.PackageLog
WHERE
BatchLogID = (SELECT BatchLogID
FROM
logging.PackageLog
WHERE
PackageLogID = @PackageLogID)
AND PackageLogID > @PackageLogID)
)
INSERT INTO logging.PackageTaskLog (PackageLogID, SourceName, SourceID, StartDateTime)
VALUES (@PackageLogID, @SourceName, @SourceID, getdate())
END