Two-loop electroweak next-to-leading logarithms for processes involving heavy quarks