Software bug formal usage
Terminology varies across the software industry; in some companies everybody is happy with "bug"; in other places you might be expected to use terms like "defect", "fault" or "issue". Sorry to not be able to give you a definite answer, but you'll need to ask around to find what's in general usage in your context.
One piece of advice which is useful though: whatever terminology you use, be consistent in distinguishing between the underlying problem in the software (fault/defect/bug/etc) and an event where something goes wrong when using the software: often the term "failure" is used for this. So for example you might have a single fault in the software, which causes multiple failures, one every time the software is used.
I think bug (or more formally, software bug) can be use in a formal context with no problem. It is the official and most correct term to describe an unexpected error that happens when a piece of software is executed.
A defect can be a bug, but it can be something else; for example an expected flaw in algorithm that makes the software perform much slower with some user's input.
Defect is generally preferable, it covers deviations from the expected results of a system, although it usually excludes problems caused by human operators (e.g. if the user enters some bad data, and the program handles the exception appropriately, as per spec, it's not a defect).
Bug is more informal - I will sometimes say something is a bug but not in formal documents. I've found it's often used interchangeably with defect. As others have noted, it may be taken to mean something more specific (code/programming error) than defect.
Even more colloquial is gremlin - e.g. the report failed that one time due to a gremlin (generally this means no-one cares to work out what caused the failure, if the problem is not reproducible).
Failure is an even more general term which would include defects as well as operator error.