I said this to one professor when she expressed about her current research work. Later, I realized that that phrase could be very informal.
It could be either, but it might edge slightly towards "formal". This expression is usually used by polite and well-educated people. This is backed up by some websites.
“I'm glad to hear that” is not informal. It can work in both professional and non-professional circumstances.
According to grammarhow - good to hear vs glad to hear
Glad to hear should be used when speaking on a more personal note, as “glad” is a feeling that we can have towards someone.
Noting this, we can deduce that it is better to use "good to hear", especially on the formal side.
It's formal enough:
“I’m glad to hear that the EU is moving in that direction,” says Barnes.
Stewart McDonald, the SNP MP for Glasgow South, said: “I’m glad to hear that this has been withdrawn – quite why they thought this would go down well is beyond me.
These both are from MP's or from similar politics environment.
Yes, it's informal. You could consider saying 'I am very pleased to hear that', or 'Congratulations! Very well done', or 'That's fantastic to hear!' or 'That's very impressive considering the minimal time you've had to do it' or 'That's impressive indeed'.
Honestly, I would not worry about it. You have said something nice to this person, so she has no right to become offended just because it was worded informally. I'm sure she won't, though.
As it is, you were very kind indeed to compliment the professor. I'm glad to hear it!